package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?:\d([\-\. ])?){7,15}`)
var str = `888-426-6840 215-861-6239
SPAIN Toll-Free: 900-8-01334
Caller Paid: 9-1-7878580
ITN Number: (*8) 2650 6840
Sandy Phillips 845-433-6476
USA Toll-Free: 888-426-6840
USA Caller Paid: 215-861-6239
Blackberry One Click +1-888-426-6840x6014774#
Call-In#: 888-426-6840 or 215-861-6239
USA/Mexico Toll-Free: 888-426-6840
Hungary Toll-Free: 06-800-19-306
Canada Toll-Free: 888-426-6840
UK Toll-Free: 0800-368-0638/02030596451
USA Toll-Free: 888-426-6840
USA Caller Paid: 215-861-6239
United Kingdom Caller Paid 0-20-30596451
United Kingdom Toll-Free 0800-368-0638`
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/