string test = "<IMG src=\"http://www.baidu.com/upload/2009_11/09112110144808.jpg\" border=0><IMG src=\"upload/2009_11/09112110144808.jpg\" border=0><img alt=\"\" src=\"/upload/201510/28/201510281002087002.png\">";
            string outhost = "www.myname.com";
            Regex reg = new Regex(@"(?is)(?<=<img\s+alt=.*src=(['""]?))(?!http://)(?=[^'""\s>]+\1)");
            string result = reg.Replace(test, "http://" + outhost + "/");
   string test = "<IMG src=\"http://www.baidu.com/upload/2009_11/09112110144808.jpg\" border=0><IMG src=\"upload/2009_11/09112110144808.jpg\" border=0>";
            string outhost = "www.myname.com";
            Regex reg = new Regex(@"(?is)(?<=<img\s+src=(['""]?))(?!http://)(?=[^'""\s>]+\1)");
            string result = reg.Replace(test, "http://" + outhost + "/");

 

相关文章:

  • 2021-04-28
  • 2021-09-03
  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
  • 2022-01-20
  • 2021-09-29
  • 2021-11-29
猜你喜欢
  • 2022-12-23
  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
  • 2021-10-13
  • 2021-07-24
  • 2022-12-23
相关资源
相似解决方案