@pengzhanbo/utils - v3.4.1
    Preparing search index...

    Function escapeRegExp

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

      转义str中的正则表达式特殊字符"^"、"$"、"\"、"."、"*"、"+"、"?"、"("、")"、"["、"]"、"{"、"}"以及"|"。

      Parameters

      • str: string

        The string to escape. 要转义的字符串

      Returns string

      The escaped string. 转义后的字符串

      escapeRegExp('[link](https://sub.domain.com/)'); // '\[link\]\(https://sub\.domain\.com/\)'