阅读(1018) (0)

Lodash _.escapeRegExp

2021-09-23 14:42:34 更新

_.escapeRegExp([string=''])

转义 RegExp 字符串中特殊的字符 "^", "$", "", ".", "*", "+", "?", "(", ")", "[", "]", ", ", 和 "|" in .

添加版本

3.0.0

参数

  1. [string=''] (string): 要转义的字符串。

返回

(string): 返回转义后的字符串。

例子

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