function escape(string) {
  return string && RE_HAS_REGEXP_CHAR.test(string)
    ? string.replace(RE_REGEXP_CHAR, String.raw`\$&`)
    : string
}
Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
"?", "(", ")", "[", "]", "{", "}", and "|" in `string`.

@param {string} string The string to escape.
@returns {string} Returns the escaped string.