标签:break UNC pre soft family turn class javascrip query
params.query = params.query.replace(/[\+\-\&\|\!\(\)\{\}\[\]\^\"\~\*\?\:\\]/g,function(a){
switch (a) {
case ‘+‘:
return ‘\\+‘
break;
case ‘-‘:
return ‘\\-‘
break;
case ‘&‘:
return ‘\\&‘
break;
case ‘|‘:
return ‘\\|‘
break;
case ‘!‘:
return ‘\\!‘
break;
case ‘(‘:
return ‘\\(‘
break;
case ‘)‘:
return ‘\\)‘
break;
case ‘{‘:
return ‘\\{‘
break;
case ‘}‘:
return ‘\\}‘
break;
case ‘[‘:
return ‘\\[‘
break;
case ‘]‘:
return ‘\\]‘
break;
case ‘^‘:
return ‘\\^‘
break;
case ‘"‘:
return ‘\\"‘
break;
case ‘~‘:
return ‘\\~‘
break;
case ‘*‘:
return ‘\\*‘
break;
case ‘?‘:
return ‘\\?‘
break;
case ‘:‘:
return ‘\\:‘
break;
case ‘\\‘:
return ‘\\\\‘
break;
default:
break;
}
})
注意需要转义。
标签:break UNC pre soft family turn class javascrip query
原文地址:https://www.cnblogs.com/mengfangui/p/9144416.html