package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)#\d+\s[A-Z]\d+(?:[,-]\s?[A-Z]\d+)*(?:;#\d+\s[A-Z]\d+(?:[,-]\s?[A-Z]\d+)*)*`)
var str = `#2 A4-B7;#4 A1,B9 or #66 A1 or #88 C7 or #9999 E78-F39 or #567 E74;#678 Q7
#6 A1, B9, C7;#77 A89-Z78;#77 A89-Z78`
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/