onigurumajs
implementation of the node-oniguruma API using xregexp, various shims, replacements, and elbow grease.
Why does this exist?
- It would be nice to be able to parse TextMate grammars (the basis for syntax highlighting in Atom) in pure JS:
- JavaScript's regex parser lacks some useful features, such as lookbehinds. onigurumajs adds them.
Usage
See node-oniguruma.
Adds support to JavaScript for
- extended xregexp syntax described here: http://xregexp.com/syntax/
- leading lookbehind zero-length assertions:
var scanner = '(?<!a)b'scanner // match.scanner // fails to match.
- lookbehind assertions following alternation characters:
var scanner = 'cat|(?<!a)b'scanner // match.scanner // match.scanner // fails to match.
\x{xxxx}
format unicode escape codes
var scanner = '\\x{2603}'scanner // match.
Contribute
This is a work in progress please join in, open some issues, submit pull requests, and help build a crazy full-featured regex parser for JavaScript.
License
ISC