package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?:I\d-?)*I3(?:-?I\d)*`)
var str = `A-B-C-I1-I2-D-E-F-I1-I3-D-D-D-D-I1-I1-I3-I1-I1-I3-I4-L-K-I3-P-F-I4-I2`
for i, match := range re.FindAllString(str, -1) {
fmt.Println(match, "found at index", i)
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/