package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?im)(?<=a\/c|acc|account|ref|reference)\b\D+[0-9A-Za-z\-\\\/]+`)
var str = `My acc reference is 123456
My reference number is 123-456
My a/c reference number is 123-4556A
A/c number is 123-3456
This is another ref. number: 123/567-2B
cat and kitten both refer to cats.
He made reference in his novel to the 1929 census.
This data uses information from the financial year 1992/93 and also makes references to 90/91 figures.
The background property refers to a hexidecimal colour, H102567.
My a/c reference number is 123/456`
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/