日期:2014-05-17 浏览次数:20468 次
string s = @"<img src=""/images/news/xxxx1.jpg"" /> <img src=""/images/news/xxxx2.jpg"" /> <img src=""/images/news/xxxx3.jpg"" />"; string r = Regex.Replace(s, @"(?is)(?<=<img[^>]+src="").+?(?=""[^>]*/>)", "http://www.xxx.com$0"); Response.Write(Server.HtmlEncode(r));
------解决方案--------------------
Regex imgsrc = new Regex(@"(?<=src=")(?=/)", RegexOptions.None)
Regex.Replace(reContent, regImg.ToString(), "http://www.xxx.com",RegexOptions.Compiled | RegexOptions.IgnoreCase);
------解决方案--------------------
string s = @"<IMG src=""/images/news/xxxx1.jpg"">";
s = Regex.Replace(s, @"(?is)(?<=<IMG\ssrc="").*?[^>](?=/)", "http://www.xxx.com/images");
Console.WriteLine(s);