package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(\d{2}:\d{2}:\d{2}:\d{3}).+(\[.{55}])`)
var str = `03712 -R->13:29:23:265 uRD 778 ReadStat 20,01,00,[OS:T------- OP:----B--- TS:----- - ---** --*---* ****--]01,9a,80,08,0a,13,00,64,7c,00,14,10,11,01,01,00,00,00,00,00,03,00,00,00,00,00,00,c9,21,00,aa,12,11,00,00,10,0a,bb,01,00,03,01,00,00,cc,01,00,01,01,00,00,01,01,dd,08,27,3b,02,00,02,ee,1a,02,80,00,00,ff,00,aa,01,00,03,00,01,00,00,00,rc=00`
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/