Escapes the RegExp special characters "^", "$", "", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", and "|" in string.
RegExp
string
The string to escape.
string Returns the escaped string.
5.12.0
[[escape]], [[escapeRegExp]], [[unescape]]
escapeRegExp('[lodash](https://lodash.com/)')// => '\[lodash\]\(https://lodash\.com/\)' Copy
escapeRegExp('[lodash](https://lodash.com/)')// => '\[lodash\]\(https://lodash\.com/\)'
Escapes the
RegExp
special characters "^", "$", "", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", and "|" instring
.