package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(\+91[\s-]\d{5}[\s-]\d{5})|(011[\s-]\d{8})|(\+91\d{2}[\s-]\d{8})|(^0\d{10})|(^[6-9]\d{9})|(91[\s-]\d{3,5}[\s-]\d{2,5}[\s-]\d{4})|(91[\s-]\d{5}[\s-]\d{5})|(91[\s-]\d{10})|(\d{4}[\s-]\d{4}[\s-]\d{3})`)
var str = `r1: (\+91[\s-]\d{5}[\s-]\d{5})|(011[\s-]\d{8})|(\+91\d{2}[\s-]\d{8})|(^0\d{10})|(^[6-9]\d{9})|(91[\s-]\d{3,5}[\s-]\d{3,5}[\s-]\d{4})|(91[\s-]\d{5}[\s-]\d{5})|(91[\s-]\d{10})
+91-98600 27066 /
+91-73871 11066
011-29534999, 011-29532555, 011 47527999
+9133 24798066,
+9133 24483458/3459
08048620522
8046041848
91 124 392 3000
91-80884 00951
91-9821328595
91 9822015432
+91 033 2461 8212
+91 033 2461 8213
645+91-98600 270664684 /
6546+91-73871 11066656
011-29534999, 011-29532555, 011 47527999
+9133 24798066656,
+9133 24483458/3459
8048620522656
8046041848656
91 124 392 3000656
91-80884 00951656
91-9821328595656656
91 9822015432656
656+91 033 2461 8212
+91 033 2461 8213656
`
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/