var str= “nimgkf<img src=‘/static/upload/2357244.png’> Ghfgv”;
var imgReg = /<img.*?(?:>|\/>)/gi;
var srcReg = /src=[\’\”]?([^\’\”]*)[\’\”]?/i;
var arr = str.match (imgReg);
for(var i =0; i < arr.length; i ++){
var src = arr[i].match (srcReg);
console.log (src[1])
}
网友评论