日期:2014-05-16 浏览次数:20488 次
str="%25E6%2597%25A5%25E6%259C%25AC";
reg=/%[\da-z]{4}/ig;
alert( reg.test(str) )
var str1 = '%25E6%2597%25A5%25E6%259C%25AC' ,
str2 = '%25E6%2597%25A5%25E6%259C%25AC%25E6%2598%25AF%25E4%25BB%2580%25E4%25B9%2588%25E4%25B8%259C%25E8%25A5%25BF';
var reg = new RegExp(str1);
console.log(reg.test(str2));
console.log(str2.match(reg));
var str1 = '%25E6%2597%25A5%25E6%259C%25AC' ,
str2 = '%25E6%2597%25A5%25E6%259C%25AC%25E6%2598%25AF%25E4%25BB%2580%25E4%25B9%2588%25E4%25B8%259C%25E8%25A5%25BF';
console.log(str1.match(/%([\d\w]*)/g));
console.log(str2.match(/%([\d\w]*)/g));