regexpset
is an extension to Go standard library regexp
. It contains a set
of regular expression patterns and provides methods for matching on input
string.
import "github.com/sugarme/regexpset"
func main(){
var patterns []string = []string{
`\w+`,
`\d+`,
`\pL+`,
`foo`,
`bar`,
`barfoo`,
`foobar`,
}
set, err := regexpset.NewRegexpSet(patterns)
if err != nil {
log.Fatal(err)
}
setmatches := set.Matches("foobar")
fmt.Println(setmatches.Matches())
// [0 1 2 3 4 6]
}
See Go.Dev Reference