MCPcopy Create free account
hub / github.com/RubyLouvre/anu / escapeRegExp

Function escapeRegExp

test/babel.js:54275–54278  ·  view source on GitHub ↗

* Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+", * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`. * * @static * @memberOf _ * @since 3.0.0 * @category String * @param {string} [string=''] The string to escape. * @returns {string} Returns the escaped st

(string)

Source from the content-addressed store, hash-verified

54273 * // => '\[lodash\]\(https://lodash\.com/\)'
54274 */
54275 function escapeRegExp(string) {
54276 string = toString(string);
54277 return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, '\\$&') : string;
54278 }
54279
54280 module.exports = escapeRegExp;
54281

Callers

nothing calls this directly

Calls 1

toStringFunction · 0.70

Tested by

no test coverage detected