package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`\b(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\b`)
var str = `67.93.195.181
248.83.55.126
277.92.425.12
220.164.237.203
36.173.112.111
36.33.171.246
37.123.14.323
23.93.163.86
236.129.173.89
2.224.237.202
256.123.123.123
69.10.174.79
35.185.155.175
6.215.157.157
123.123.123.234
188.43.121.96
101.22.3.71
1.1.1.1
55.58.142.177
179.107.91.118`
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/