Skip to content

Latest commit

 

History

History
75 lines (58 loc) · 2.08 KB

File metadata and controls

75 lines (58 loc) · 2.08 KB

👹 Onigmo bindings for Go

It binds the regular expression library Onigmo to Go.

Travis Codecov GitHub release GoDoc MIT License

Benchmarks

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%

Usage

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()
}

Installation

$ 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

Contribution

  1. Fork (https://github.com/linyows/go-onigmo/fork)
  2. Create a feature branch
  3. Commit your changes
  4. Rebase your local changes against the master branch
  5. Run test suite with the go test ./... command and confirm that it passes
  6. Run gofmt -s
  7. Create a new Pull Request

Author

linyows