createWordRegExp()function
createWordRegExp(pattern: NamedRegExp<T>, start?: PossibleRegExp, end?: PossibleRegExp): T extends NamedRegExpData ? NamedRegExp<T> : RegExp
createWordRegExp(pattern: PossibleRegExp, start?: PossibleRegExp, end?: PossibleRegExp): T extends NamedRegExpData ? NamedRegExp<T> : RegExp
| Param | Type | |
|---|---|---|
pattern | NamedRegExp<T> | The content pattern to match between the boundaries (a NamedRegExp to type the captured data). required |
start | PossibleRegExp | The leading boundary pattern (defaults to WORD_START_REGEXP). |
end | PossibleRegExp | The trailing boundary pattern (defaults to WORD_END_REGEXP). |
pattern | PossibleRegExp | Things that can be converted to a regular expression. required |
start | PossibleRegExp | Things that can be converted to a regular expression. |
end | PossibleRegExp | Things that can be converted to a regular expression. |
| Return | |
|---|---|
T extends NamedRegExpData ? NamedRegExp<T> : RegExp | A RegExp (a NamedRegExp<T> when the content pattern names its capture groups). |
T extends NamedRegExpData ? NamedRegExp<T> : RegExp |
Create a RegExp that matches a word of content, wrapped between word-start and word-end boundaries.
Factory for RegExp.
Examples
createWordRegExp("(?<char>[*_])+")