Fix MustCompile comment error
This commit is contained in:
parent
3f8e58ad58
commit
526be69307
@ -64,10 +64,11 @@ func main() {
|
||||
// function name.
|
||||
fmt.Println(r.Match([]byte("peach")))
|
||||
|
||||
// When creating constants with regular expressions
|
||||
// you can use the `MustCompile` variation of
|
||||
// `Compile`. A plain `Compile` won't work for
|
||||
// constants because it has 2 return values.
|
||||
// When creating global variables with regular
|
||||
// expressions you can use the `MustCompile` variation
|
||||
// of `Compile`. `MustCompile` panics instead of
|
||||
// returning error, which makes it safer to use for
|
||||
// global variables.
|
||||
r = regexp.MustCompile("p([a-z]+)ch")
|
||||
fmt.Println(r)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user