package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^\s{8,9}\d{1,2}\s{2}\|\s{9,10}\d{1,2}\s{2}\|\s{9,10}\d{1,2}$`)
var str = ` 12 | 11 | 5
13 | 3 | 13
5 | 16 | 3
15 | 2 | 20
8 | 5 | 16
4 | 12 | 3
20 | 1 | 14
9 | 1 | 1
15 | 13 | 14
15 | 1 | 1
18 | 15 | 5
5 | 1 | 18
13 | 9 | 8
16 | 1 | 1
5 | 5 | 14
7 | 17 | 10
8 | 13 | 20
12 | 2 | 20
8 | 14 | 3
14 | 11 | 18
6 | 11 | 14
19 | 12 | 3
8 | 7 | 13
8 | 3 | 20`
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/