日期:2014-05-17 浏览次数:20428 次
string str=@"HTML源码"; str=str.Match(str,@"(?i)<a\b[^>]*?href=([""']?)([^""']*?)\1[^>]*?>下一页</a>").Groups[2].Value;
------解决方案--------------------
var s = '<div class="pages" id="pageDivTop"><a href="http://www.tianya.cn/publicforum/content/stocks/1/727805.shtml">首页</a><a href="http://www.tianya.cn/publicforum/content/stocks/1/1046188.shtml">802</a><a href="http://www.tianya.cn/publicforum/content/stocks/1/1046773.shtml">803</a><a href="http://www.tianya.cn/publicforum/content/stocks/1/1047058.shtml">804</a><a href="http://www.tianya.cn/publicforum/content/stocks/1/1047264.shtml">805</a><a href="http://www.tianya.cn/publicforum/content/stocks/1/1047606.shtml">806</a><a href="http://www.tianya.cn/publicforum/content/stocks/1/1048293.shtml">807</a><a href="http://www.tianya.cn/publicforum/content/stocks/1/1048651.shtml">808</a><a href="http://www.tianya.cn/publicforum/content/stocks/1/1049081.shtml">809</a><em class="current">810</em><a href="http://www.tianya.cn/publicforum/content/stocks/1/1050069.shtml">811</a><a href="http://www.tianya.cn/publicforum/content/stocks/1/1050069.shtml">下一页</a><a href="http://www.tianya.cn/publicforum/content/stocks/1/1050069.shtml">末页</a><a href="#adsp_content_replybox_frame_1">回复此贴</a><span>共811页</span><form';
var reg = new RegExp("<a[^>]*>[^>]*下一页[^>]*<\s?\/\s?a>", "g");
var txt = "";
s = reg.exec(s).pop();
alert(s);