From: Ivan Moscoso Date: Sat, 15 Jul 2017 17:53:48 +0000 (-0600) Subject: regexp: clarify example for 'FindString' X-Git-Tag: go1.9rc1~50 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6bfd2d19ffa5b9700e1ddc8744bdfedf40d2b705;p=gostls13.git regexp: clarify example for 'FindString' Clarifying that FindString only provides left-most match Change-Id: Ic6ecec12cca759fd4b3565ef5901a110843ffd56 Reviewed-on: https://go-review.googlesource.com/48609 Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot --- diff --git a/src/regexp/example_test.go b/src/regexp/example_test.go index d05e87b0db..8661d6d389 100644 --- a/src/regexp/example_test.go +++ b/src/regexp/example_test.go @@ -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" // "" }