diff --git a/examples/regular-expressions/regular-expressions.go b/examples/regular-expressions/regular-expressions.go index f05d269..e10e934 100644 --- a/examples/regular-expressions/regular-expressions.go +++ b/examples/regular-expressions/regular-expressions.go @@ -31,7 +31,7 @@ func main() { // This also finds the first match but returns the // start and end indexes for the match instead of the // matching text. - fmt.Println(r.FindStringIndex("peach punch")) + fmt.Println("idx:", r.FindStringIndex("peach punch")) // The `Submatch` variants include information about // both the whole-pattern matches and the submatches @@ -50,7 +50,7 @@ func main() { // These `All` variants are available for the other // functions we saw above as well. - fmt.Println(r.FindAllStringSubmatchIndex( + fmt.Println("all:", r.FindAllStringSubmatchIndex( "peach punch pinch", -1)) // Providing a non-negative integer as the second @@ -70,7 +70,7 @@ func main() { // returning an error, which makes it safer to use for // global variables. r = regexp.MustCompile("p([a-z]+)ch") - fmt.Println(r) + fmt.Println("regexp:", r) // The `regexp` package can also be used to replace // subsets of strings with other values. diff --git a/examples/regular-expressions/regular-expressions.hash b/examples/regular-expressions/regular-expressions.hash index bffd787..63ee8ef 100644 --- a/examples/regular-expressions/regular-expressions.hash +++ b/examples/regular-expressions/regular-expressions.hash @@ -1,2 +1,2 @@ -c0dd720036ac70269ce233bf47c5d6aefd43161f -LEKGY_d3Nu_P +5c3bcf9f8c61fc074143f766c4517e445a6d9b0f +htCqJrLdh9Q diff --git a/examples/regular-expressions/regular-expressions.sh b/examples/regular-expressions/regular-expressions.sh index 1f3882c..ec4f201 100644 --- a/examples/regular-expressions/regular-expressions.sh +++ b/examples/regular-expressions/regular-expressions.sh @@ -1,15 +1,15 @@ -$ go run regular-expressions.go +$ go run regular-expressions.go true true peach -[0 5] +idx: [0 5] [peach ea] [0 5 1 3] [peach punch pinch] -[[0 5 1 3] [6 11 7 9] [12 17 13 15]] +all: [[0 5 1 3] [6 11 7 9] [12 17 13 15]] [peach punch] true -p([a-z]+)ch +regexp: p([a-z]+)ch a a PEACH diff --git a/public/regular-expressions b/public/regular-expressions index f1eeb4a..e6592ea 100644 --- a/public/regular-expressions +++ b/public/regular-expressions @@ -43,7 +43,7 @@ in Go.

- +
package main
 
@@ -141,7 +141,7 @@ matching text.

-    fmt.Println(r.FindStringIndex("peach punch"))
+    fmt.Println("idx:", r.FindStringIndex("peach punch"))
 
@@ -200,7 +200,7 @@ functions we saw above as well.

-    fmt.Println(r.FindAllStringSubmatchIndex(
+    fmt.Println("all:", r.FindAllStringSubmatchIndex(
         "peach punch pinch", -1))
 
@@ -250,7 +250,7 @@ global variables.

     r = regexp.MustCompile("p([a-z]+)ch")
-    fmt.Println(r)
+    fmt.Println("regexp:", r)
 
@@ -296,18 +296,18 @@ text with a given function.

-
$ go run regular-expressions.go 
+          
$ go run regular-expressions.go
 true
 true
 peach
-[0 5]
+idx: [0 5]
 [peach ea]
 [0 5 1 3]
 [peach punch pinch]
-[[0 5 1 3] [6 11 7 9] [12 17 13 15]]
+all: [[0 5 1 3] [6 11 7 9] [12 17 13 15]]
 [peach punch]
 true
-p([a-z]+)ch
+regexp: p([a-z]+)ch
 a <fruit>
 a PEACH
@@ -340,7 +340,7 @@ the regexp package docs