package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)\.[A-Za-z]+\.\d+`)
var str = `aaa/prt001.prt.1
aaa/prt001.prt.2
aaa/prt001.prt.3
aaa/prt001.prt.4
aaa/prt001.prt.5
aaa/prt001.prt.10
aaa/prt001.asm.1
aaa/prt001.asm.2
aaa/prt001.asm.3
aaa/prt001.txt.10
aaa/prt001.txt.20
aaa/prt001.txt.30
bbb/prt001.prt
bb/prt.001.prt
bb/prt.001.prt.1
bb/prt.001.1
bb/prt.ppp.prt`
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/