package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m) +--> +([a-zA-Z_\/.-]+):(\d+):(\d+)::::(.*)`)
var str = ` --> src/blah.rs:55:32::::error: expected one of \`,\`, \`.\`, \`?\`, \`}\`, or an operator, found \`;\`
|
55 | 4u8 => unimplemented!(); 42,
| -- ^ expected one of \`,\`, \`.\`, \`?\`, \`}\`, or an operator here
| |
| while parsing the \`match\` arm starting here
--> src/foobar.rs:4:1::::error[E0072]: recursive type \`foo::Bar\` has infinite size
|
| errors are bad, mkay?
`
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/