获取url参数,替换特殊字符

 function GetQueryString(name){
var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if(r!=null){
var b = decodeURI(r[2]).
replace(/\+/g," ").
replace(/%2B/g,"+").
replace(/%22/g,'"').
replace(/%27/g,"'").
replace(/%2F/g,"/").
replace(/%23/g,"#").
replace(/%3D/g,"=").
replace(/%26/g,"&").
replace(/%40/g,"@").
replace(/%3B/g,";").
replace(/%3F/g,"?").
replace(/%2C/g,",").
replace(/%24/g,"$");
return b
}
return null;
}
上一篇:php 正则替换特殊字符 和检测是否是中文


下一篇:Asp.Net Core微服务初体验