mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 18:55:26 +00:00
refactor(util) escapeRegExp
This commit is contained in:
parent
fc3c8b6892
commit
1b663e9bdf
1 changed files with 4 additions and 5 deletions
|
|
@ -529,14 +529,13 @@
|
|||
return conv;
|
||||
};
|
||||
|
||||
this.escapeRegExp = function(pStr) {
|
||||
var ret = pStr,
|
||||
isStr = Util.isString(pStr);
|
||||
this.escapeRegExp = function(str) {
|
||||
var isStr = Util.isString(str);
|
||||
|
||||
if (isStr)
|
||||
ret = pStr.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||
str = str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||
|
||||
return ret;
|
||||
return str;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue