package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?mi)((low-|\d-|<-|<|->|>)\d*$)|other|low-high|(^\dhigh$)|^\d*$`)
var str = `low-18
-20
19
20<-40
41-70
71-high
71-higher
low-71-high
lower-71
high-low
low-high
other
71-turn`
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/