deniskyashif / regexjs

A fast and minimal regular expression engine.

Home Page:https://deniskyashif.com/implementing-a-regular-expression-engine/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

regexjs

Build Status

A regular expression engine implementation in JavaScript. It supports concatenation, union (|), zero-or-more (*), one-or-more (+), and zero-or-one (?) 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

About

A fast and minimal regular expression engine.

https://deniskyashif.com/implementing-a-regular-expression-engine/


Languages

Language:JavaScript 100.0%