NRegexp is a wrapper around regexp.Regexp
that allow you to use named captures. It exposes regexp.Regexp
methods.
package main
import (
"fmt"
"github.com/mdouchement/nregexp"
)
func main() {
re := nregexp.MustCompile(`.*\s.*\s(?P<my_capture>[^\s]*)\s.*`)
fmt.Printf("%v\n", re.NamedCaptureString("Example of nregexp package"))
}
MIT
All PRs are welcome.
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request
As possible, run the following commands to format and lint the code:
# Format
find . -name '*.go' -not -path './vendor*' -exec gofmt -s -w {} \;
# Lint
golangci-lint run --enable-all