Find All Matches with Indexes
Examples
Filter
package main
import (
"fmt"
"regexp"
)
func main() {
re := regexp.MustCompile(`a.`)
fmt.Println(re.FindAllStringIndex("paranormal", -1))
fmt.Println(re.FindAllStringIndex("paranormal", 2))
fmt.Println(re.FindAllStringIndex("graal", -1))
fmt.Println(re.FindAllStringIndex("none", -1))
}
Last Run
:
[[1 3] [3 5] [8 10]]
[[1 3] [3 5]]
[[2 4]]
[]