createRegExpAny()function
createRegExpAny(patterns: Iterable<PossibleRegExp> & NotString, flags?: string): RegExp
| Param | Type | |
|---|---|---|
patterns | Iterable<PossibleRegExp> & NotString | The regular expressions or string sources to combine. required |
flags | string | The flags to use when creating the combined RegExp. |
| Return | |
|---|---|
RegExp | A RegExp that matches if any of the provided expressions match. |
Create a regular expression that matches any one of a list of other expressions.
- If the list is empty the returned expression matches nothing (
NEVER_REGEXP).
Examples
createRegExpAny(["abc", "def"]); // /(?:abc)|(?:def)/