package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`\-(((ae|as)|(ge|et|xe)\-\d\/\d\/)\d+(:\d){0,1}\.\d+)`)
var str = `policerdrop-bs.[lim2m-xe-0/0/1.10106-inet-i]
policerdrop-bs.[lim256k-ge-2/0/0.159-inet-i]
policerdrop-bs.[lim256k-ae2.159-inet-i]
policerdrop-bs.[lim2m-xe-0/0/1:0.10106-inet-i]
policerdrop-bs.[limbw-1m-xe-1/0/0.6027-inet-i]`
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/