A small tool for building regular expressions.
We build a RegExp object by combining functions.
We only support ES modules.
import carol from 'carol-js';
const regex = carol.seq([
carol(/hello/),
carol(/ /),
carol(/world/),
carol(/!/).many(1),
]).many().toRegex();
assert.strictEqual(regex.source, '(?:hello world(?:!)+)*');
npm i carol-js
git clone https://github.com/marihachi/carol-js.git
cd carol-js
npm i
npm run build
npm test
MIT