Merge branch 'fix-mustcompile-comment' of https://github.com/gren236/gobyexample into gren236-fix-mustcompile-comment

This commit is contained in:
Mark McGranaghan 2020-04-10 17:58:08 -07:00
commit 88676f43b2

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