imgSrcReplace(htmlstr) {
let regex3 = new RegExp(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi);
let htmlstr1 = htmlstr.replace(regex3, function(match, capture) {
// capture 为你匹配到的地址
// localtionPath 为你想要拼接的地址
let newStr = '<img src=' + localtionPath + capture + ' alt="" />';
return newStr;
});
regex3 = null;
return htmlstr1;
},
标签:src,img,capture,标签,地址,let,regex3
From: https://www.cnblogs.com/rzl795/p/17023001.html