package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^[1-9]\d*(?:[ -]?(?:[a-zA-Z]+|[1-9]\d*))?$`)
var str = `25
25 a
25b
25-ab
12-14
1
9
21
1a
121 b
25A
25 a
1 a1
1a1
12ab12
0
b
0a
00a
a a
00 a
13àâäèéêë
`
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/