美文网首页
Filter img src value from string

Filter img src value from string

作者: yilinUnique | 来源:发表于2020-03-24 16:56 被阅读0次
var aa = "<img src='aa111.jpg'><p></p><div class='demo'>444</div>r32r32r";
//get img label
aa.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, function (match) {
    console.log(match);
});
//get src value
aa.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, function (match, capture) {
    console.log(capture);
});

相关文章

网友评论

      本文标题:Filter img src value from string

      本文链接:https://www.haomeiwen.com/subject/vhfayhtx.html