imgSrcReplace(htmlstr) {
      let that = this;
      let regex3 = new RegExp(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi);
      let domainURL = "http://www.baidu.com/";
      let htmlstr1 = htmlstr.replace(regex3, function (match, capture) {
        console.log("capture:", capture);
        let tmp = capture.split(domainURL + "");
        capture = "http://www.amei.com" + tmp[1];
        var newStr = "<img src=" + capture + ' alt="" />';
        return newStr;
      });
      regex3 = null;
      console.log("htmlstr1:", htmlstr1);
      return htmlstr1;
    },
posted on 2020-07-13 20:41  阿梅M  阅读(2860)  评论(0编辑  收藏  举报