getRegExpSource()function
getRegExpSource(regexp: PossibleRegExp): string
| Param | Type | |
|---|---|---|
regexp | PossibleRegExp | The regular expression or string source to read. required |
| Return | |
|---|---|
string | The string source of the regular expression. |
Convert a regular expression to its string source.
- If
regexpis astringit is returned as-is, otherwise its.sourceis returned.
Examples
getRegExpSource(/abc/); // "abc"