Merge branch 'gren236-fix-mustcompile-comment'
This commit is contained in:
commit
46cfb589ee
@ -64,10 +64,11 @@ func main() {
|
|||||||
// function name.
|
// function name.
|
||||||
fmt.Println(r.Match([]byte("peach")))
|
fmt.Println(r.Match([]byte("peach")))
|
||||||
|
|
||||||
// When creating constants with regular expressions
|
// When creating global variables with regular
|
||||||
// you can use the `MustCompile` variation of
|
// expressions you can use the `MustCompile` variation
|
||||||
// `Compile`. A plain `Compile` won't work for
|
// of `Compile`. `MustCompile` panics instead of
|
||||||
// constants because it has 2 return values.
|
// returning an error, which makes it safer to use for
|
||||||
|
// global variables.
|
||||||
r = regexp.MustCompile("p([a-z]+)ch")
|
r = regexp.MustCompile("p([a-z]+)ch")
|
||||||
fmt.Println(r)
|
fmt.Println(r)
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
3db643ab821ee2a5b70e05fbadbde1a7f7ba1591
|
c0dd720036ac70269ce233bf47c5d6aefd43161f
|
||||||
944r7pT2YIl
|
LEKGY_d3Nu_P
|
||||||
|
11
public/regular-expressions
generated
11
public/regular-expressions
generated
@ -43,7 +43,7 @@ in Go.</p>
|
|||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td class="code leading">
|
<td class="code leading">
|
||||||
<a href="http://play.golang.org/p/944r7pT2YIl"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
|
<a href="http://play.golang.org/p/LEKGY_d3Nu_P"><img title="Run code" src="play.png" class="run" /></a><img title="Copy code" src="clipboard.png" class="copy" />
|
||||||
<div class="highlight"><pre><span class="kn">package</span> <span class="nx">main</span>
|
<div class="highlight"><pre><span class="kn">package</span> <span class="nx">main</span>
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
|
||||||
@ -242,10 +242,11 @@ function name.</p>
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="docs">
|
<td class="docs">
|
||||||
<p>When creating constants with regular expressions
|
<p>When creating global variables with regular
|
||||||
you can use the <code>MustCompile</code> variation of
|
expressions you can use the <code>MustCompile</code> variation
|
||||||
<code>Compile</code>. A plain <code>Compile</code> won’t work for
|
of <code>Compile</code>. <code>MustCompile</code> panics instead of
|
||||||
constants because it has 2 return values.</p>
|
returning an error, which makes it safer to use for
|
||||||
|
global variables.</p>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
<td class="code leading">
|
<td class="code leading">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user