package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?sm)^([^,]+?),.+?(?:(\n(?!\1))|\Z)`)
var str = `Christi,19946752,20194048
Christi,20369664,20520192
Christi,20520192,20631296
Christi,20123984,20124432
Brandon,20194048,20369664
Brandon,20745984,20980736
Brandon,22341211,22443280
Joe-010,28729383,28733432
Joe-010,23488449,23499482`
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/