打赏

lodash escapeRegExp 转义正则特殊字符

_.escapeRegExp([string=''])

转义RegExp 中特殊的字符 "^", "$", "\", ".", "*", "+", "?", "(", ")", "[", "]", "{", "}", 以及 "|"。

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

 

posted @ 2018-06-21 18:39  孟繁贵  阅读(1809)  评论(0编辑  收藏  举报
TOP