日期:2014-05-18  浏览次数:20432 次

求asp.net(c#)下,一个正则表达式?
一字符串:
<td align="center" foroyesgo="target">
<a href="http://www.fortraveler.com/ch/travel_guide/destination_guide/u/prague/index.html" class="absu" title="布拉格" target="_blank">布拉格</a>,<a href="http://www.fortraveler.com/ch/travel_guide/destination_guide/u/krumlov/index.html" class="absu" title="克罗姆洛夫" target="_blank">克罗姆洛夫</a>,<a href="http://www.fortraveler.com/ch/travel_guide/destination_guide/u/budejovice/index.html" class="absu" title="布杰约维采" target="_blank">布杰约维采</a>
</td>
没有回车换行符,求<td align="center" foroyesgo="target">与</td>之间的值。
thanks

------解决方案--------------------
Regex.Match方法没有那样的重载

C# code
Match m = Regex.Match(yourStr, @"<td[^>]*>(?<text>[\s\S]*?)</td>", RegexOptions.IgnoreCase);
if (m.Success)
{
    Response.Write(m.Groups["text"].Value);
}