Combine multiple regexes into one
npm install regex-combinerCombines an array of regexes into a single regex.
``js
var regexCombiner = require('regex-combiner');
var combined = regexCombiner([
/abc$/,
/abcd+e/,
/a.*/,
/bar/,
'bad+' // strings are accepted too
]);
/ /(a(bc($|d+e)|.)|ba(r|d+))/ */
combined.test('abcdddde'); // true
combined.test('bar'); // true
combined.test('baddd'); // true
`
- No flags! Combining case-sensitive and case-insensitive regexes is ... difficult, so all flags are ignored.
- No back-references in the input regexes. Things like /(['"])foo\1/ are just not going to work..test()`. Trying to get something meaningful from the
- The resulting regex is pretty much only going to be useful for
groups is not going to be fun.
MIT