Fix MustCompile comment error

This commit is contained in:
Egor Rudkov 2020-02-26 23:23:33 +03:00
parent 3f8e58ad58
commit 526be69307

View File

@ -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)