日期:2014-05-19  浏览次数:20403 次

求高手帮忙看看这样的正则表达试怎么写?在线等!!!
<tr   bgColor=#8DD3F6>
                    <td   width= "134 "   height= "28 "   align= "center "   valign= "middle "   bgcolor= "#FFCC00 "> <strong> 名称 </strong> </td>
                    <td   width= "142 "   align= "center "   valign= "middle "   bgcolor= "#FFCC00 "> <strong> 地址 </strong> </td>
                    <td   width= "118 "   align= "center "   valign= "middle "   bgcolor= "#FFCC00 "     > <strong> 时间 </strong> </td>
                    <td   width= '70 '   align= "center "   valign= "middle "   bgcolor= "#FFCC00 "> <strong> 线路 </strong> </td>

                        <td   width= '217 '   align= "center "   bgcolor= "#FFCC00 "> <strong> 版本信息 </strong> </td>
                    <td   width= "65 "   align= "center "   bgcolor= "#FFCC00 "> <strong> 星级 </strong> </td>
                    <td   width= "35 "   align= "center "   bgcolor= "#FFCC00 "> <strong> 介绍 </strong> </td>
                </tr>

匹配这样的正则表达式怎么写呢?求教高手!

------解决方案--------------------
也就是要其中的数据?
------解决方案--------------------
又改了下,这样

string start = textBox1.Text;
string content = " ";
if (Regex.IsMatch(start, @ "今日新开 "))
{
Match m = Regex.Match(yourStr, @ "(? <= <table[\s\S]*? <\!-- 今日新开私服信息)[\s\S]*? </table> ", RegexOptions.IgnoreCase);
  if (m.Success)
  {
   content = m.Value;
}
}
else
{
Match m = Regex.Match(yourStr, @ "(? <= <div[^> ]*?> [^ <]*? " + start + @ "[\s\S]*?) <table[^> ]*?> [\s\S]*? </table> ", RegexOptions.IgnoreCase);
if (m.Success)
{
content = m.Value;
}
}

MatchCollection mc = Regex.Matches(content, @ " <td[^> ]*?> ((&nbsp;\s*|\s*)?( <[^> ]*?> )?)*([^ <]*?)\s*( <(?!/td> )[\s\S]*?)? </td> ", RegexOptions.IgnoreCase);
foreach (Match ma in mc)
{
richTextBox2.Text += ma.Groups[4].Value + "\n ";
}