regexp-factorize
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Regexp Factorize

install

npm i regexp-factorize

Sample

import { factorizeOr } from 'regexp-factorize';

const keywords = ['ant', 'antelope', 'albatross', 'alligator'];
const regexpString = factorizeOr(keywords); // a(?:nt(?:|elope)|l(?:batross|ligator))
const regexp = new RegExp(regexpString);

const document = "There's an alligator in my house";

console.log(regexp.test(document)); // true

/regexp-factorize/

    Package Sidebar

    Install

    npm i regexp-factorize

    Weekly Downloads

    1

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    4.3 kB

    Total Files

    4

    Last publish

    Collaborators

    • nico