日期:2014-05-17  浏览次数:20454 次

求帮助:用正则表达式截取我需要的内容
<div class="pageNavBot">
  <div class="pageNav">
  <span>共<strong>47</strong>个产品</span><a class="pre preDisable" href="javascript:void(0)"><span><span>上一页</span></span></a>
  <a class="curr" href="javascript:void(0)"><span>1</span></a> <a href="http://www.newegg.com.cn/SubCategory/575-2.htm#itemGrid1">
  <span>2</span></a> <a class="next" href="http://www.newegg.com.cn/SubCategory/575-2.htm#itemGrid1">
  <span><span>下一页</span></span></a>
  <input type="text" maxlength="4" id="setShowPageNav" value="自定义" class="input70 hasDefaultText">
  <a id="btnSetShowPageNav" style="display: none;" href="javascript:void(0);" ref1="http://www.newegg.com.cn/SubCategory/575-paramPageNumber.htm#itemGrid1">
  <span>确定</span></a></div>
  </div>
用正则表达式截取当前页,和第二页,或者还有更多页,我想截取除当前页以外其他页码的超链接。
正则表达式刚学,不会写。请帮忙,谢谢。

------解决方案--------------------
探讨

引用:
引用:

改一下正则
(?is)<a\b[^>]*?(class=(["']?)(?:(?!(curr)).)+?\1)?[^>]*?href=(["']?)([^"']*?)\4[^>]*>

取第五个分组
Groups[5].Value

谢谢噢,可是我用了会出现一点错误。
Regex reg = new Regex(@"(?is……