package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(\b(?:\w+)?\d+(?:\w+)?(?:[\-\/])?(?:\w+)?(?:\d+)?\b)`)
var str = `Park Avenue number 100
Baker Street number 100
Baker Street 100
The bakery shop is located on 109-111 Wharfside Street
My mother's house is on 40-42 Parkway
My schoolmate lives in 25b-26 Sun Street
The apartment is located on R2-R3 City Quay
I live in 43a Garden Walk
I live in 6/7 Marine Road
I live in 10-12 Acacia Ave
I live in 4513 3RD STREET CIRCLE WEST
I live in 1/2 Fifth Avenue
number C3-H4 sawojajar Malang`
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/