package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?<!version":")(\d+\.\d+\.\d+\.\d+)`)
var str = `2018-09-15 15:59:41,311 INFO [Timer-0]-dashboard.PSDashboard: getProcessSummary --> processing output line
[32mOk: {"status":200,"name":"xya.com","version":"1.1.2.371","cis":"online","tagline":""}[0m
2018-09-15 15:59:40,106 INFO [Timer-0]-util.SSHUtil: Connecting to host [10.60.9.59] using provided credentials.
2018-09-15 15:59:40,209 INFO [Timer-0]-util.SSHUtil: Connected to host [10.60.9.29] using provided credentials.
2018-09-15 15:59:40,209 INFO [Timer-0]-util.SSHUtil: Connected to host 10.60.9.34 using provided credentials.`
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/