mirror of
https://github.com/golang/go
synced 2024-11-11 18:51:37 -07:00
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 <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
9c5eadf413
commit
6bfd2d19ff
@ -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"
|
||||
// ""
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user