escapeRegExp
The escapeRegExp() function escapes special characters in a string so it can be reused in a regular expression without altering its meaning.
Interactive example
Syntax
typescript
function escapeRegExp<
GenericInput extends string
>(
input: GenericInput
): string;Parameters
input: String to escape for use in a regex.
Return value
A string where all regex metacharacters have been escaped.
See also
interpolation- Generates typed templates with placeholders
