From f61bd8bb502191e5eb9d6dc0b0b93f546c37bb85 Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Tue, 30 Oct 2012 17:59:11 -0700 Subject: [PATCH] explain variants --- examples/regular-expressions/regular-expressions.go | 5 +++++ examples/regular-expressions/regular-expressions.sh | 1 + 2 files changed, 6 insertions(+) diff --git a/examples/regular-expressions/regular-expressions.go b/examples/regular-expressions/regular-expressions.go index a5a27e6..5eb8631 100644 --- a/examples/regular-expressions/regular-expressions.go +++ b/examples/regular-expressions/regular-expressions.go @@ -46,6 +46,11 @@ func main() { // example to find all matches for a regexp. 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 // argument to these functions will limit the number // of matches. diff --git a/examples/regular-expressions/regular-expressions.sh b/examples/regular-expressions/regular-expressions.sh index 69f689c..1f3882c 100644 --- a/examples/regular-expressions/regular-expressions.sh +++ b/examples/regular-expressions/regular-expressions.sh @@ -6,6 +6,7 @@ peach [peach ea] [0 5 1 3] [peach punch pinch] +[[0 5 1 3] [6 11 7 9] [12 17 13 15]] [peach punch] true p([a-z]+)ch