It binds the regular expression library Onigmo to Go.
These are the benchmarks as they are defined in Go's regexp package.
$ go test -bench RE2 | sed 's/RE2/Regexp/' > before
$ go test -bench Onigmo | sed 's/Onigmo/Regexp/' > after
$ benchcmp before after
benchmark old ns/op new ns/op delta
BenchmarkRegexp-4 25775 31043 +20.44%
func main() {
s := "Hello World"
re := MustCompile("^Hello (?<word>[A-z]*)$")
re.MatchString(s)
word, _ := re.matchResult.Get("word")
fmt.Sprintf("Naruhodo! The %s", word)
defer re.matchResult.Free()
defer re.Free()
}
$ git clone git@github.com:linyows/go-onigmo.git && cd go-onigmo
$ make onigmo
To install, use go get
:
$ go get -d github.com/linyows/go-onigmo
- Fork (https://github.com/linyows/go-onigmo/fork)
- Create a feature branch
- Commit your changes
- Rebase your local changes against the master branch
- Run test suite with the
go test ./...
command and confirm that it passes - Run
gofmt -s
- Create a new Pull Request