<tr  bgcolor=#F8F8F8 onmouseout=this.bgColor='#F8F8F8' onMouseOver="this.bgColor='#E9F2FE'" id="tr43111">
<td height="24" align="center"><input type="checkbox" name="talent_no" ></td>
<td align="center"></td>
<td align="center"></td>
<td align="center"><img src='/images2008/webcam.jpg'></td>
<td align="center"></td>
<td align="center">&nbsp;</td>
<td align="center"></td>
<td width="10%" nowrap><a href="html_43111.aspx" target="_blank" id="kkk43111">
莫先生</a></td>
<td width="4%" nowrap align="center"></td>
<td width="4%" nowrap align="center"></td>
<td width="7%" nowrap align="center"></td>
<td nowrap align="center"></td>
<td nowrap width="180" align="center"> 
计算机
</td>
<td nowrap width="150" align="center">北京经贸学校</td>

<td nowrap align="center">11-11-11 11:11</td>

</tr>
<tr  bgcolor=#F8F8F8 onmouseout=this.bgColor='#F8F8F8' onMouseOver="this.bgColor='#E9F2FE'" id="tr43112">
<td height="24" align="center"><input type="checkbox" name="talent_no"></td>
<td align="center"></td>
<td align="center"></td>
<td align="center"><img src='/images2008/webcam.jpg'></td>
<td align="center"></td>
<td align="center">&nbsp;</td>
<td align="center"></td>
<td width="10%" nowrap><a href="html_43112.aspx" target="_blank" id="kkk43112">
123先生</a></td>
<td width="4%" nowrap align="center"></td>
<td width="4%" nowrap align="center"></td>
<td width="7%" nowrap align="center"></td>
<td nowrap align="center">北京</td>
<td nowrap width="180" align="center"> 

</td>
<td nowrap width="150" align="center">北京大学</td>

<td nowrap align="center">11-11-11 11:11</td>

</tr>我如何取上面 tr 每一行的html_43112.aspx 中html_后面的数字
地点:北京 
还有时间11-11-11 11:11取三条数据 数字,地点,时间。
提取html中的tr和td的正则表达式,或者方法。求代码

解决方案 »

  1.   


                using (StreamReader reader = new StreamReader(@"D:\test.txt"))
                {
                    string str = reader.ReadToEnd();
                    Regex reg = new Regex(@"(?is)<tr.*?html_(?<ID>\d+)\.aspx.*?<td nowrap align=""center"">(.*?)</td>.*?<td nowrap align=""center"">(.*?)</td>.*?</tr>");                foreach (Match m in reg.Matches(str))
                    {
                        Console.WriteLine(m.Groups["ID"].Value);
                        Console.WriteLine(m.Groups[1].Value);
                        Console.WriteLine(m.Groups[2].Value);
                    }
                }
     把你的html信息保存到test.txt文件中