explain variants

This commit is contained in:
Mark McGranaghan 2012-10-30 17:59:11 -07:00
parent af5f06f263
commit f61bd8bb50
2 changed files with 6 additions and 0 deletions

View File

@ -46,6 +46,11 @@ func main() {
// example to find all matches for a regexp. // example to find all matches for a regexp.
fmt.Println(r.FindAllString("peach punch pinch", -1)) fmt.Println(r.FindAllString("peach punch pinch", -1))
// These `All` variants are available for the other
// functions we saw above as well.
fmt.Println(r.FindAllStringSubmatchIndex(
"peach punch pinch", -1))
// Providing a non-negative integer as the second // Providing a non-negative integer as the second
// argument to these functions will limit the number // argument to these functions will limit the number
// of matches. // of matches.

View File

@ -6,6 +6,7 @@ peach
[peach ea] [peach ea]
[0 5 1 3] [0 5 1 3]
[peach punch pinch] [peach punch pinch]
[[0 5 1 3] [6 11 7 9] [12 17 13 15]]
[peach punch] [peach punch]
true true
p([a-z]+)ch p([a-z]+)ch