package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^\w(\d{1,})\.\w(\d{0,2})`)
var str = `B43.C21.D10.E110
B52.C21.D22.E000
B52.C21.D22.E000
B42.C11.D10.E120
B42.C11.D10.E120
B42.C11.D10.E120
B42.C11.D10.E120
B42.C11.D10.E120
B42.C11.D10.E120
B42.C11.D10.E120
B42.C11.D10.E120
B42.C11.D20
B42.C11.D20
B46.C71.D11.E000
B81.C21.D10.E000
B80.C20.D10.E000
B81.C10.D10.E000
B35.C11.D10.E116
B19.C20.D2
B81.C10.D10.E000
B80.C20.D10.E000
B46.C3
B36.C00.D11.E000`
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/