读书人

帮写个正则获取lt;imggt;里边的src

发布时间: 2013-09-13 21:12:00 作者: rapoo

帮写个正则,获取<img>里面的src
我这个img标签不仅仅是

<img src=""/>

也包含一些样式
<img src="" style="" class=""  style="width:353px;height:249px;" alt="帮写个正则,获取<img>里边的src"/>

我只要src
正则 html
[解决办法]
Regex reg1 = new Regex(@"(?i)<img[^>]*?src=(['""]?)(?<src>[^'""\s>]+)\1[^>]*>", RegexOptions.IgnoreCase 
[解决办法]
RegexOptions.Singleline);
MatchCollection mc = reg1.Matches(page);
foreach (Match m1 in mc)
{
string imgUrl = m1.Groups["src"].Value;
}

[解决办法]
like this?
http://www.cnblogs.com/insus/archive/2012/10/30/2745843.html

读书人网 >asp.net

热点推荐