Skip to content
A minimalistic regular expression engine.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__tests__ bugfix: the priority of concat operator should higher than the union Feb 26, 2019
src bugfix: the priority of concat operator should higher than the union Feb 26, 2019
.gitignore initial commit Feb 11, 2019
README.md
package-lock.json refactor: naming and tests Feb 13, 2019
package.json refactor: naming and tests Feb 13, 2019

README.md

regexjs

A simple regular expression engine implemented in JavaScript. It supports concatenation, union (|) and closure (*) operations as well as grouping. It follows Ken Thompson's algorithm for constructing an NFA from a regular expression.

Check out my blog post for the complete implementation details.

Example

const { createMatcher } = require('./regex');
const match = createMatcher('(a|b)*c');

match('ac'); // true
match('abc'); // true
match('aabababbbc'); // true
match('aaaab'); // false

Try It

git clone https://github.com/deniskyashif/regexjs.git
cd regexjs
npm i
npm start

Run the tests

npm t

You can’t perform that action at this time.