package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?mi)^(?:u|(?:a\.|i[1,3-5]\.)?c|h1\-c0[1-7]|h3\-c0[1-4]|h5\-c0[1-5])\.eset\.com|(?:avcloud|dnsj)\.e5\.sk$`)
var str = `h1-c01.eset.com
h1-c02.eset.com
h1-c03.eset.com
h1-c04.eset.com
h1-c05.eset.com
h1-c06.eset.com
h1-c07.eset.com
h3-c01.eset.com
h3-c02.eset.com
h3-c03.eset.com
h3-c04.eset.com
h5-c01.eset.com
h5-c02.eset.com
h5-c03.eset.com
h5-c04.eset.com
h5-c05.eset.com
avcloud.e5.sk
dnsj.e5.sk
u.eset.com
c.eset.com
a.c.eset.com
i1.c.eset.com
i3.c.eset.com
i4.c.eset.com
i5.c.eset.com`
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/