求个Csdn论坛的正则表达式
憋了半天都没憋出来。还是求大神给个吧。
http://bbs.csdn.net/forums/DotNET
把这个地址的HTML下来了,然后想用正则获取每个帖子的 标题,分数,提问人,回复数,最后更新时间
<tr>
<td class="title">
<strong class="green">?</strong>
<a href="/topics/390338558" target="_blank" title="C# 怎么读取水晶报表(.rpt)中的sql语句">C# 怎么读取水晶报表(.rpt)中的sql语句</a>
<span class="forum_link">[<span class="parent"><a href="/forums/DotNET">.NET技术</a></span> <a href="/forums/CSharp">C#</a>]</span>
</td>
<td class="tc">100</td>
<td class="tc">
<a href="http://my.csdn.net/kingtoo030" target="_blank">kingtoo030</a><br />
<span class="time">01-06 15:14</span></td>
<td class="tc">3</td>
<td class="tc">
<a href="http://my.csdn.net/happy09li" target="_blank">happy09li</a><br />
<span class="time">01-09 14:16</span>
</td>
<td class="tc">
<a href="/topics/390338558/close" target="_blank">管理</a>
</td>
</tr>
------解决方案--------------------(?is)(?<=title)[^>""]+(?="">)
------解决方案--------------------建议用HtmlAgilityPack,比正则好用。
http://zhoufoxcn.blog.51cto.com/792419/595344
http://blog.csdn.net/dalmeeme/article/details/7191793
------解决方案--------------------对了,Options 需要 SingleLine或者
(?is)title="(?<title>[^"]+)">.*?"tc">(?<point>\d+)</td>.*?_blank">(?<user>[^<]+)</a>.*?time">(?<time>[^<]+).*?time">(?<lastTime>[^<]+)
------解决方案--------------------(?is)<tr>\s*<td[^>]*?>.*?title="(?<title>[^"]+?)".*?<td\s*class="tc">(?<score>\d+).*?<td\s*class="tc">\s*<a[^>]*?>(?<author>.*?)</a>.*?<td\s*class="tc">(?<Num>\d+)</td>.*?<td\s*class="tc">\s*<a[^>]*?>.*?</a><span\s*class="time">(?<lasttime>.*?)</span>.*?</tr>
------解决方案-------------------- var match = Regex.Match(str, @"(?is).*?<a[^>]*>(?<title>[^<>]+)</a>.*?<td\s*class=""\w+"">(?<fenshu>\d+)</td>.*?<a[^>]*>(?<tiwenren>[^<>]+)</a>.*?<td\s*class=""\w+"">(?<huifushu>\d+)</td>.*?<span\s*class=""time"">(?<time>[^<>]+)</span>");
Console.WriteLine(match.Groups["title"].Value + "," + match.Groups["fenshu"].Value + "," + match.Groups["tiwenren"].Value + "," + match.Groups["huifushu"].Value + "," + match.Groups["time"].Value);