src code
RegExp.escape(str) → String
str
String
RegExp
Escapes any characters in the string that have special meaning in a regular expression.
Use before passing a string into the RegExp constructor.