Date

“String” Methods

_.escapeRegExp([string=''])

source npm package

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

引入版本

3.0.0

参数
[string=''] (string) : The string to escape.

返回值
(string) : Returns the escaped string.

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