• This repository has been archived on 14/Jul/2018
  • Stars
    star
    220
  • Rank 180,422 (Top 4 %)
  • Language
    Go
  • License
    MIT License
  • Created about 13 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Super Fast Regex in Go

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/moovweb/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
}

More Repositories

1

gvm

Go Version Manager
Shell
10,035
star
2

gokogiri

A light libxml wrapper for Go
Go
600
star
3

harlem_shaker

CSS
182
star
4

gosass

Go language wrapper for LibSass (the C/C++ implementation of Sass).
Go
73
star
5

golog

Simple logging framework for go.
Go
47
star
6

uranium

JS library for Mobile Web
JavaScript
43
star
7

go-cache

adaptive replacement cache
Go
37
star
8

tritium

Tritium is a magical document modifying language. It's JavaScript-like and simple to learn. Think XSLT without the nightmare. It was designed by Hampton Catlin (@hcatlin), and has been heavily influenced by Aaron Leung (@akhleung).
HTML
33
star
9

spracker

Go language module for generating CSS sprite sheets.
Go
19
star
10

react-storefront-boilerplate

A starter project for apps built with react-storefront
JavaScript
19
star
11

open-tritium

Open source implementation of the Tritium language.
C
18
star
12

pupstats

Pull puppet stats from syslog for use in graphite
Ruby
16
star
13

versions

Go
13
star
14

log4go

log4go extension
Go
7
star
15

css2xpath

Go
6
star
16

icu4go

go port of icu4c
HTML
6
star
17

goconv

go port of iconv
Go
6
star
18

gpkg

Go Package Manager for GVM
Go
5
star
19

fusion

Javascript bundler plugin.
Go
4
star
20

ptcp

placeholder
Go
3
star
21

craigslist

Sample project
JavaScript
2
star
22

dnsrr

Rewrite DNS for testing applications
Ruby
2
star
23

moovui

Sass UIKit for moovweb style UI elements across all of our sites
JavaScript
2
star
24

moov-pwa-boilerplate

Clone this project to start your new app based on Moov PWA.
JavaScript
1
star
25

mtv-ted

JavaScript
1
star
26

go-gb

go building tool branch (support pkg-config in cgo)
Go
1
star
27

wikipedia

Sample project - beginner example
JavaScript
1
star
28

kirkos

Go
1
star
29

mtv-reddit

JavaScript
1
star
30

xdn-templates

Templates used with create-xdn-app
TypeScript
1
star
31

xdn-examples

Example apps showing how to use various frameworks with the Moovweb XDN
Vue
1
star
32

react-storefront-express-boilerplate

Starter project for building react-storefront apps with express.
JavaScript
1
star