Skip to content

bcoe/onigurumajs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

onigurumajs

Build Status Coverage Status NPM version

implementation of the node-oniguruma API using xregexp, various shims, replacements, and elbow grease.

Why does this exist?

  1. It would be nice to be able to parse TextMate grammars (the basis for syntax highlighting in Atom) in pure JS:

  1. JavaScript's regex parser lacks some useful features, such as lookbehinds. onigurumajs adds them.

Usage

See node-oniguruma.

Adds support to JavaScript for

var scanner = new OnigScanner(['(?<!a)b'])
scanner.test('bb') // match.
scanner.test('ab') // fails to match.
  • lookbehind assertions following alternation characters:
var scanner = new OnigScanner(['cat|(?<!a)b'])
scanner.test('cat') // match.
scanner.test('bb') // match.
scanner.test('ab') // fails to match.
  • \x{xxxx} format unicode escape codes
var scanner = new NOnigScanner(['\\x{2603}'])
scanner.findNextMatchSync('☃') // 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

About

👺 a pure JavaScript port of the oniguruma regex engine

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published