function regexpEscape(s) {
  const regexpSpecialChars = /[\^\$\\\.\*\+\?\(\)\[\]\{\}\|]/g;
  // "$&" in the replacement string is replaced with the matched string
  return s.replace(regexpSpecialChars, "\\$&");
}
// prefix special characters with "\" for creating a regex
prefix special characters with "\" for creating a regex
prefix special characters with " \ " for creating a regex
function regexpEscape(s) {
  const regexpSpecialChars = /[\^\$\\\.\*\+\?\(\)\[\]\{\}\|]/g;
  return s.replace(regexpSpecialChars, "\\$&");
}
function regexpEscape ( s ) { const regexpSpecialChars = / [\^\$\\\.\*\+\?\(\)\[\]\{\}\|] / g ; return s . replace ( regexpSpecialChars , "\\$&" ) ; }
prefix special characters with "\" for creating a regex
prefix special characters with " \ " for creating a regex
// "$&" in the replacement string is replaced with the matched string