日期:2014-05-17 浏览次数:20708 次
<div class="content" title="2013-03-26 12:00:42">我需要的内容</div>
Regex regImg = new Regex(@"<div class=""content"" title="".*"">?<imgUrl>(.*)</div>", RegexOptions.IgnoreCase);
// 搜索匹配的字符串sHtmlText 为html内容
MatchCollection matches = regImg.Matches(sHtmlText);
int i = 0;
string[] sUrlList = new string[matches.Count];
// 取得匹配项列表
foreach (Match match in matches)
sUrlList[i++] = match.Groups["imgUrl"].Value;
return sUrlList;