87,910
社区成员
发帖
与我相关
我的任务
分享
var val1 = "<img border=\"0\" src='id=xxxxx'>";
var val2 = '<img src=s.php?id=xxxxx>';
var val3 = '<img src="s.php?id=xxxxx">';
var val4 = '<img src=\'s.php?id=xxxxx\' border="0">';
var pattern = /^<img.*src=([\'|\"]?)([\w\.]*\?)?id=\w+\1.*>$/i;
alert(val1.match(pattern));
var html = "<img border=\"0\" src='s.php?id=xxxxx'>"//y
+"<img src='s.php?id=xxxxx' border=\"0\">"//y
+"<img src=\"s.php?id=xxxxx\">"//y
+"<img src=s.php?id=xxxxx>"//y
+"<img src=wwwx.php?id=www a=2>"//no
+"<img src=wwws.php?id=www a=2>";//no
var p = /<img[^>]*src\s*=\s*(["'])?(?=s\.php)[^>]*>/ig
alert(html.match(p))
var html = "<img border=\"0\" src='s.php?id=xxxxx'>"//y
+"<img src='s.php?id=xxxxx' border=\"0\">"//y
+"<img src=\"s.php?id=xxxxx\">"//y
+"<img src=s.php?id=xxxxx>"//y
+"<img src=wwwx.php?id=www a=2>"//no
+"<img src=wwws.php?id=www a=2>";//y
var p = /<img[^>]*src\s*=\s*(["'])?[^>]*(?=s\.php)[^>]*>/ig
alert(html.match(p))
var arrImg=document.getElementsByTagName("img"),arrResult=[];
for(var i=0;i<arrImg.length;i++){
if(arrImg[i].src.indexOf("s.php")>-1){
arrResult.push(arrImg[i].src);
}
}