package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?im)^[a-z](\d\d?|[a-z]\d[a-z\d]?|[a-z]?\d?\d \d[a-z]{2}|[a-z]\d [a-z] \d[a-z]{2})$`)
var str = `A0
B11
CC2
DD3D
EE44
F5 5FF
G77 7GG
HH8 8HH
II9 I 9II
JJ00 0JJ
00
0A
AA
111
1B1
11B
C1C
1CC
CCC
3333
D333
3D33
33D3
333D
E4E4
E44E
4EE4
4E4E
44EE
DDD3
D3DD
3DDD
DDDD
`
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/