package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^(.*?) : (.+? MB\/s)( \[.*)?$`)
var str = `Sequential Read : 135.091 MB/s
Sequential Write : 126.046 MB/s
Random Read 512KB : 44.569 MB/s
Random Write 512KB : 117.965 MB/s
Random Read 4KB (QD=1) : 0.468 MB/s [ 114.4 IOPS]
Random Write 4KB (QD=1) : 8.412 MB/s [ 2053.6 IOPS]
Random Read 4KB (QD=32) : 0.654 MB/s [ 159.6 IOPS]
Random Write 4KB (QD=32) : 10.751 MB/s [ 2624.7 IOPS]
Test : 1000 MB [C: 7.3% (64.9/889.4 GB)] (x5)
Date : 2015/12/09 22:06:02
OS : Windows 8.1 [6.3 Build 9600] (x64)`
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/