https://github.com/scottlamb/recapture
Go helper for saving regular expression capture groups.
https://github.com/scottlamb/recapture
Last synced: 2 months ago
JSON representation
Go helper for saving regular expression capture groups.
- Host: GitHub
- URL: https://github.com/scottlamb/recapture
- Owner: scottlamb
- License: mit
- Created: 2014-09-29T03:51:45.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2014-09-29T03:52:02.000Z (almost 12 years ago)
- Last Synced: 2025-02-26T15:45:15.502Z (over 1 year ago)
- Language: Go
- Size: 102 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Go helper for saving regular expression capture groups.
Modelled after the [RE2 C++
API](https://code.google.com/p/re2/source/browse/re2/re2.h).
Example:
r := regexp.MustCompile("(.*) (.*) (.*) (.*)")
var a, b, c, d int
err := recapture.MatchString(
r, "100 40 0100 0x40",
recapture.Octal(&a), recapture.Hex(&b),
recapture.CRadix(&c), recapture.CRadix(&d))
if err == nil {
// prints 64 64 64 64
fmt.Printf("%d %d %d %d", a, b, c, d)
} else {
fmt.Printf("match failed: %v", err)
}
Get started with:
go get github.com/scottlamb/recapture
godoc github.com/scottlamb/recapture