百分求解.net正则问题
<tr>
<td class="tdcell" style='width:80px;'>
rate1 </td>
<td class="tdcell" style='width:80px;'>
rate2 </td>
<td class="tdcell">
n/a
</td>
<td class="tdcell">
<a href="/secondary/W_J_Mouat_Secondary/Abbotsford/Report_Card.aspx">W J Mouat Secondary</a>
</td>
<td class="tdcell">
name</a>
</td>
<td class="tdcell" style='width:80px;'>
7.4 </td>
<td class="tdcell" style='width:80px;'>
7.2 </td>
</tr>
要取的页面里有一个表,以上我贴的是表里的一行,我要取的是标红的部分
请问用正则一次把这些取出放入一个datetable,谢谢
------解决方案--------------------
string str ="<tr> <td class=\"tdcell\" style='width:80px;'> rate1 </td> <td class=\"tdcell\" style='width:80px;'>rate2 </td> <td class=\"tdcell\">n/a</td> <td class=\"tdcell\"> <a href= \"secondary/W_J_Mouat_Secondary/Abbotsford/Report_Card.aspx\">W J Mouat Secondary</a></td><td class=\"tdcell\">name</a></td><td class=\"tdcell\" style='width:80px;'>7.4 </td><td class=\"tdcell\" style='width:80px;'>7.2 </td> </tr>";
Regex reg = new Regex(@"(?is)<td\sclass=""tdcell""[^>]*>(.*?)</td>");
MatchCollection mc = reg.Matches(str);
foreach (Match m in mc)
{
Console.Write(m.Groups[1].Value + "\n");
}
rate1
rate2
n/a
<a href= "secondary/W_J_Mouat_Secondary/Abbotsford/Report_Card.aspx">W J Mouat Secondary</a>
name</a>
7.4
7.2