62,046
社区成员
发帖
与我相关
我的任务
分享
<img style="width: 500px; height: 332px; " src="/WebUI/Background/images/ShowImg[9].gif" alt="">
/WebUI/Background/images/ShowImg[9].gif
void Main()
{
string hcontent2=@"<img style=""width: 500px; height: 332px; "" src=""/WebUI/Background/images/ShowImg[9].gif"" alt="""">";
foreach(Match m in Regex.Matches(hcontent2,@"(?i)(?<=<img[^>]*?src=(['""\s]?))[^'""\s]+(?=\1)"))
{
Console.WriteLine(m.Value);
}
/*
/WebUI/Background/images/ShowImg[9].gif
*/
}
string str = "<img src=xx.png />"
+ "<img src=\"aa.jpg\" />";
Regex reg = new Regex(@"(?is)<img[^>]*?scr=(['""\s]?)([^'""\s]+)\1[^>]*?>");
MatchCollection match = reg.Matches(str);
foreach (Match m in match)
{
Response.Write(m.Groups[2].Value + "<br/>");
}