Function escapeRegExp

  • Escapes the RegExp special characters "^", "$", "", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", and "|" in string.

    Parameters

    • Optionalstring: string

      The string to escape.

    Returns string

    Returns the escaped string.

    3.0.0

    escape, escapeRegExp, unescape

    escapeRegExp('[lodash](https://lodash.com/)')
    // => '\[lodash\]\(https://lodash\.com/\)'