110,534
社区成员
发帖
与我相关
我的任务
分享
<TABLE cellSpacing=0 cellPadding=0 width="90%" border=0>
<TBODY>
<TR>
<TD height=6></TD></TR></TBODY></TABLE><FONT class=p6 color=#3366cc>●</FONT></TD>
<TD vAlign=center width="75%" height=20><A class=a2 href="t20090911_402586300.htm" target=_blank>8月份国民经济主要指标数据</A></TD>
<TD class=a2 vAlign=center width="20%" height=20>2009年09月11日</TD></TR>
<TR>
<TD vAlign=top align=middle width="5%" height=25>
<TABLE cellSpacing=0 cellPadding=0 width="90%" border=0>
<TBODY>
<TR>
<TD height=6></TD></TR></TBODY></TABLE><FONT class=p6 color=#3366cc>●</FONT></TD>
<TD vAlign=center width="75%" height=20><A class=a2 href="t20090910_402585842.htm" target=_blank>1-8月全国房地产市场运行情况</A></TD>
<TD class=a2 vAlign=center width="20%" height=20>2009年09月10日</TD></TR>
<TR>
<TD vAlign=top align=middle width="5%" height=25>
<TABLE cellSpacing=0 cellPadding=0 width="90%" border=0>
<TBODY>
<TR>
<TD height=6></TD></TR></TBODY></TABLE><FONT class=p6 color=#3366cc>●</FONT></TD>
<TD vAlign=center width="75%" height=20><A class=a2 href="t20090901_402583588.htm" target=_blank>8月份全国制造业采购经理指数继续回升</A></TD>
<TD class=a2 vAlign=center width="20%" height=20>2009年09月01日</TD></TR>
<TR>
<TD vAlign=top align=middle width="5%" height=25>
<TABLE cellSpacing=0 cellPadding=0 width="90%" border=0>
<TBODY>
<TR>
<TD height=6></TD></TR></TBODY></TABLE><FONT class=p6 color=#3366cc>●</FONT></TD>
<TD vAlign=center width="75%" height=20><A class=a2 href="t20090828_402582842.htm" target=_blank>1-7月份工业利润降幅继续缩小</A></TD>
<TD class=a2 vAlign=center width="20%" height=20>2009年08月28日</TD></TR>
<TR>
<TD vAlign=top align=middle width="5%" height=25>
<TABLE cellSpacing=0 cellPadding=0 width="90%" border=0>
<TBODY>
<TR>
<TD height=6></TD></TR></TBODY></TABLE><FONT class=p6 color=#3366cc>●</FONT></TD>
<TD vAlign=center width="75%" height=20><A class=a2 href="t20090811_402578483.htm" target=_blank>7月份国民经济主要指标数据</A></TD>
<TD class=a2 vAlign=center width="20%" height=20>2009年08月11日</TD></TR>
string url = string.Empty;
int temp = 0;
Regex reg = new Regex(@"(?is)<a(?:(?!href=).)*href=(['""]?)(?<url>[^'""\s>]+)\1[^>]*>\s*(?<mon>\d+)月份国民经济主要指标数据\s*</a>");
reg.Replace(yourStr, delegate(Match m) { if (Convert.ToInt32(m.Groups["mon"].Value) > temp) { temp = Convert.ToInt32(m.Groups["mon"].Value); url = m.Groups["url"].Value; } return ""; });
richTextBox2.Text = url;
string url = string.Empty;
int temp = 0;
Regex reg = new Regex(@"(?is)<a(?:(?!href=).)*href=(['""]?)(?<url>[^'""\s>]+)\1[^>]*>\s*(?<mon>\d+)月份国民经济主要指标数据\s*</a>");
reg.Replace(yourStr, delegate(Match m) { if (Convert.ToInt32(m.Groups["mon"].Value) > temp) { temp = Convert.ToInt32(m.Groups["mon"].Value); url = m.Groups["url"].Value; } return ""; });
richTextBox2.Text = url;
HtmlAgilityPack.HtmlDocument htmlDoc = new HtmlAgilityPack.HtmlDocument();
htmlDoc.Load(url);//url是你要获取数据的网页路劲
HtmlNodeCollection nodes = htmlDoc.DocumentNode.SelectNodes("//a");//这里获取所有的超链接,最后循环获取每个HtmlNode,HtmlNode.InnerText是获取去除标签后的内容,比较下时间久可以通过HtmlNode.Attributes["href"].Value来获取链接地址