This code (A) package main
import ( "fmt" "regexp" ) func main() { fmt.Printf("%v", regexp.MustCompile(`a*`).FindAllStringIndex(`baaab`, -1)) } (https://play.golang.org/p/WeyStT0Gbn) Produces [[0 0] [1 4] [5 5]] Why there is no match at [4 4]? That's at the (start of the) second letter b in the text, analogically to the first match [0, 0]. Am I missing something or is it a bug? In a similar program, the symmetry is present (B) package main import ( "fmt" "regexp" ) func main() { fmt.Println(regexp.MustCompile(`a*`).FindAllStringIndex(``, -1)) fmt.Println(regexp.MustCompile(`a*`).FindAllStringIndex(`b`, -1)) fmt.Println(regexp.MustCompile(`a*`).FindAllStringIndex(`bb`, -1)) fmt.Println(regexp.MustCompile(`a*`).FindAllStringIndex(`bbb`, -1)) } (https://play.golang.org/p/m0kbrNQp21) Output [[0 0]] [[0 0] [1 1]] [[0 0] [1 1] [2 2]] [[0 0] [1 1] [2 2] [3 3]] Thanks in advance to anyone enlightening me. FTR: The regular expression and the test text in (A) is part of the regexp package tests at [0]. [0]: https://github.com/golang/go/blob/0d818588685976407c81c60d2fda289361cbc8ec/src/regexp/find_test.go#L44 -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.