Escapes the RegExp special characters "^", "$", "\", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", and "|" in str.
str
转义str中的正则表达式特殊字符"^"、"$"、"\"、"."、"*"、"+"、"?"、"("、")"、"["、"]"、"{"、"}"以及"|"。
The string to escape. 要转义的字符串
The escaped string. 转义后的字符串
escapeRegExp('[link](https://sub.domain.com/)'); // '\[link\]\(https://sub\.domain\.com/\)' Copy
escapeRegExp('[link](https://sub.domain.com/)'); // '\[link\]\(https://sub\.domain\.com/\)'
Escapes the RegExp special characters "^", "$", "\", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", and "|" in
str.转义
str中的正则表达式特殊字符"^"、"$"、"\"、"."、"*"、"+"、"?"、"("、")"、"["、"]"、"{"、"}"以及"|"。