]> Cypherpunks repositories - gostls13.git/commitdiff
regexp: clarify example for 'FindString'
authorIvan Moscoso <moscoso@gmail.com>
Sat, 15 Jul 2017 17:53:48 +0000 (11:53 -0600)
committerIan Lance Taylor <iant@golang.org>
Sat, 15 Jul 2017 20:38:58 +0000 (20:38 +0000)
Clarifying that FindString only provides left-most match

Change-Id: Ic6ecec12cca759fd4b3565ef5901a110843ffd56
Reviewed-on: https://go-review.googlesource.com/48609
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/regexp/example_test.go

index d05e87b0db13fb71e1df377434aa20a27ebfc8a0..8661d6d389df4c42d38a1018ffeafe92967d0754 100644 (file)
@@ -39,11 +39,11 @@ func ExampleMatchString() {
 }
 
 func ExampleRegexp_FindString() {
-       re := regexp.MustCompile("fo.?")
-       fmt.Printf("%q\n", re.FindString("seafood"))
+       re := regexp.MustCompile("foo.?")
+       fmt.Printf("%q\n", re.FindString("seafood fool"))
        fmt.Printf("%q\n", re.FindString("meat"))
        // Output:
-       // "foo"
+       // "food"
        // ""
 }