package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?ms)^frame=(?'frame'\s*[\d]+\n)fps=(?'fps'\s*.*?\n).+bitrate=(?'bitrate'\s*.*?)k.+out_time_ms=(?'time'\s*.*?)\n.+speed=(?'speed'\s*.*?)\n`)
var str = `frame=160
fps=0.00
stream_0_0_q=-1.0
bitrate=1431.0kbits/s
total_size=957885
out_time_us=5355167
out_time_ms=5355167
out_time=00:00:05.355167
dup_frames=0
drop_frames=0
speed=27.3x
progress=end
`
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/