package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^[ \t]*((none|dotted|dashed|solid|double|groove|ridge|(?:in|out)set|hidden|inherit|initial|revert|unset){1}([ \t]+(none|dotted|dashed|solid|double|groove|ridge|(?:in|out)set|hidden|inherit|initial|revert|unset)){0,3})[\t ]*$`)
var str = `
none
dotted
dashed
dotted dotted
dashed dashed dashed
solid solid solid solid
inset outset
# Errors - must not match
nonee
dotte2d
dashed-
dotted -dotted
dasheddashed dashed
solid fake solid solid`
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/