转义
escapeHTML: function(a){
a = "" + a;
return a.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'");;
}
反转义
unescapeHTML: function(a){
a = "" + a;
return a.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'");
}
匹配url
var str = 'fasfahttps://www.baidu.com欢迎'
var reg = /(http:\/\/|https:\/\/)((\w|=|\?|\.|\/|&|-)+)/g
str.replace(reg,'')