package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^\w+\s\d+\s\d+:\d+:\d+\ssvr\-\w+\-nac-(01|02)\s`)
var str = `May 20 10:59:30 svr-orw-nac-01 2020-05-20 17:59:30,646
May 20 11:01:01 svr-ies-nac-02 2020-05-20 18:01:01,389`
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/