regexp-flags-upfront
v0.1.1
Published
Make regexps from a string that contains the flags as well as the pattern.
Downloads
3
Readme
regexp-flags-upfront
Make regexps from a string that contains the flags as well as the pattern.
API
This module exports one function:
makeRegExp(spec[, addFlags])
Where spec
is your RegExp pattern, with a catch: If it starts with an
expression like (?imu:)
, its letters will be used as the RegExp flags.
If addFlags
is given, it should be an empty string or a string of only
letters. They will be merged with the flags possibly found in spec
.
Returns a RegExp object.
Known issues
- Needs more/better tests and docs.
License
ISC