package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?<!\S)(?:[1-9]\d\d?,\d{3}|(?:[1-9]\d?|1[0-4]\d),\d{3},\d{3}|150,000,000)(?!\S)`)
var str = `10,000
10,001
10,100
100,000
999,999
149,999,999
150,000,000
55,555
99,999
73,129
834,101
1,333,333
149,000,000
20,111,000
99,001,000
10,001,000
10,999,999
2,999,999
950,000
999,999
910,000
949,999
950,000
949,999,999
1,999,999,999
100,949,999,999
1
1,0
9,000
9,999
5,555
250,000,000
9,999
100000
150,000,001
150,000,100
150,001,000
150,100,000
151,000,000
9,150,000,000
160,000,000
000,000,000
`
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/