Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gbbr/rubex
limetext's rubex library with oniguruma statically linked in
https://github.com/gbbr/rubex
Last synced: about 1 month ago
JSON representation
limetext's rubex library with oniguruma statically linked in
- Host: GitHub
- URL: https://github.com/gbbr/rubex
- Owner: gbbr
- License: mit
- Created: 2015-05-14T03:32:31.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-05-14T03:41:26.000Z (over 9 years ago)
- Last Synced: 2024-06-21T13:04:04.654Z (5 months ago)
- Language: C
- Homepage:
- Size: 480 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rubex : Super Fast Regexp for Go #
by Zhigang Chen ([email protected] or [email protected])***ONLY USE go1 BRANCH***
A simple regular expression library that supports Ruby's regexp syntax. It implements all the public functions of Go's Regexp package, except LiteralPrefix. By the benchmark tests in Regexp, the library is 40% to 10X faster than Regexp on all but one test. Unlike Go's Regrexp, this library supports named capture groups and also allow "\\1" and "\\k" in replacement strings.
The library calls the Oniguruma regex library (5.9.2, the latest release as of now) for regex pattern searching. All replacement code is done in Go. This library can be easily adapted to support the regex syntax used by other programming languages or tools, like Java, Perl, grep, and emacs.
## Installation ##
First, ensure you have Oniguruma installed. On OS X with brew, its as simple as
brew install oniguruma
On Ubuntu...sudo apt-get install libonig2
Now that we've got Oniguruma installed, we can install Rubex!
go install github.com/limetext/rubex
## Example Usage ##
import "rubex"
rxp := rubex.MustCompile("[a-z]*")
if err != nil {
// whoops
}
result := rxp.FindString("a me my")
if result != "" {
// FOUND A STRING!! YAY! Must be "a" in this instance
} else {
// no good
}