https://github.com/linyows/go-onigmo
:japanese_ogre: Onigmo bindings for Go
https://github.com/linyows/go-onigmo
c cgo golang onigmo onigmo-bindings regex
Last synced: 3 months ago
JSON representation
:japanese_ogre: Onigmo bindings for Go
- Host: GitHub
- URL: https://github.com/linyows/go-onigmo
- Owner: linyows
- License: mit
- Created: 2017-10-14T14:35:46.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-05-23T05:19:25.000Z (over 6 years ago)
- Last Synced: 2025-07-11T14:40:17.116Z (3 months ago)
- Topics: c, cgo, golang, onigmo, onigmo-bindings, regex
- Language: Go
- Homepage:
- Size: 36.1 KB
- Stars: 7
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
:japanese_ogre: Onigmo bindings for Go
=======================================It binds the regular expression library Onigmo to Go.
[][travis]
[][codecov]
[][release]
[][godocs]
[][license][travis]: https://travis-ci.org/linyows/go-onigmo
[codecov]: https://codecov.io/gh/linyows/go-onigmo
[release]: https://github.com/linyows/go-onigmo/releases
[godocs]: http://godoc.org/github.com/linyows/go-onigmo
[license]: https://github.com/linyows/go-onigmo/blob/master/LICENSEBenchmarks
----------These are the benchmarks as they are defined in Go's regexp package.
```sh
$ 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
-----```go
func main() {
s := "Hello World"
re := MustCompile("^Hello (?[A-z]*)$")
re.MatchString(s)
word, _ := re.matchResult.Get("word")
fmt.Sprintf("Naruhodo! The %s", word)defer re.matchResult.Free()
defer re.Free()
}
```Installation
------------```sh
$ git clone git@github.com:linyows/go-onigmo.git && cd go-onigmo
$ make onigmo
```To install, use `go get`:
```sh
$ go get -d github.com/linyows/go-onigmo
```Contribution
------------1. Fork ([https://github.com/linyows/go-onigmo/fork](https://github.com/linyows/go-onigmo/fork))
1. Create a feature branch
1. Commit your changes
1. Rebase your local changes against the master branch
1. Run test suite with the `go test ./...` command and confirm that it passes
1. Run `gofmt -s`
1. Create a new Pull RequestAuthor
------[linyows](https://github.com/linyows)