package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)user\s\'(?<User>[^']+)'\shas\s(?<Result>\w+)\sauthentication.*(count\sequals\s(?<Count>\d+))?`)
var str = `2018-07-02 09:18:44,761 https-nsse-nio-8663-exec-90 anonymous 558x723020x25 5lqwk7 88.128.203.123,30.118.254.78 /best/madget/1.0/login The user 'JRA3620' has FAILED authentication. `
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/