On Tuesday, August 16, 2016 at 1:00:15 PM UTC+2, Jan Mercl wrote:
>
> 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?
>


Seems like these sentences from the regexps docs match your case:

"If 'All' is present, the routine matches successive non-overlapping 
matches of the entire expression. Empty matches abutting a preceding match 
are ignored. "


The match at [4 4] would be an empty match abutting a preceding match.

Damian

>

-- 
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.

Reply via email to