首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

能不能求个解析一段网页的正则表达式,该怎么解决

2012-03-27 
能不能求个解析一段网页的正则表达式tableclass inputTable trtdclass formLabel Terminal /

能不能求个解析一段网页的正则表达式
<table   class= "inputTable "> <tr> <td   class= "formLabel ">
                                Terminal </td>
<td   class= "inactiveInputFieldWhite ">
CTA&nbsp;
</td>
<td   class= "inactiveField ">

geloescht   am   10.07.07   um   0014&nbsp;
</td>
</tr>

</table>

网页内容如上,如何写一个正则表达式把 <td> </td> 标签之间的内容入“geloescht   am   10.07.07   um   0014&nbsp;”提取出来。

谢谢!!

[解决办法]
try

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

热点排行