Skip to content

mdouchement/nregexp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Named Regexp Capture

CircleCI GoDoc Go Report Card License

NRegexp is a wrapper around regexp.Regexp that allow you to use named captures. It exposes regexp.Regexp methods.

Usage

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

License

MIT

Contributing

All PRs are welcome.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. 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