关于正则的提取

小怪兽你一点也不乖 发布于 2017/03/19 16:32
阅读 45
收藏 0
<div class="box1 b4">
  <h2>酷书包每日推荐</h2>
  <ul><li>1<a href="http://www.kushubao.com/17335/" target="_blank">完美世界</a></li><li>2<a href="http://www.kushubao.com/144/" target="_blank">武炼巅峰</a></li><li>3<a href="http://www.kushubao.com/10191/" target="_blank">大主宰</a></li><li>4<a href="http://www.kushubao.com/20330/" target="_blank">儒道至圣</a></li><li>5<a href="http://www.kushubao.com/60/" target="_blank">官道无疆</a></li><li>6<a href="http://www.kushubao.com/43209/" target="_blank">雪鹰领主</a></li><li>7<a href="http://www.kushubao.com/20754/" target="_blank">我真是大明星</a></li><li>8<a href="http://www.kushubao.com/29133/" target="_blank">夜天子</a></li><li>9<a href="http://www.kushubao.com/18949/" target="_blank">星战风暴</a></li><li>10<a href="http://www.kushubao.com/20200/" target="_blank">超品相师</a></li><li>11<a href="http://www.kushubao.com/5/" target="_blank">校花的贴身高手</a></li><li>12<a href="http://www.kushubao.com/45267/" target="_blank">一剑飞仙</a></li><li>13<a href="http://www.kushubao.com/10190/" target="_blank">黑铁之堡</a></li><li>14<a href="http://www.kushubao.com/50283/" target="_blank">玄界之门</a></li><li>15<a href="http://www.kushubao.com/18719/" target="_blank">大明武夫</a></li><li>16<a href="http://www.kushubao.com/39916/" target="_blank">黄金渔场</a></li><li>17<a href="http://www.kushubao.com/8045/" target="_blank">无敌唤灵</a></li><li>18<a href="http://www.kushubao.com/20333/" target="_blank">造化之门</a></li><li>19<a href="http://www.kushubao.com/2929/" target="_blank">不败战神</a></li><li>20<a href="http://www.kushubao.com/2214/" target="_blank">九星天辰诀</a></li></ul>
  </div>
  <div class="box b1">
  <h2>玄幻·奇幻小说</h2>
  <ul>
  <li class="lltitle">日排名 <span>日 <a href="##" alt="1">总</a></span></li>
  <li>1<a href="http://www.kushubao.com/17335/" target="_blank">完美世界</a></li><li>2<a href="http://www.kushubao.com/10191/" target="_blank">大主宰</a></li><li>3<a href="http://www.kushubao.com/56664/" target="_blank">重生之都市修仙</a></li><li>4<a href="http://www.kushubao.com/20330/" target="_blank">儒道至圣</a></li><li>5<a href="http://www.kushubao.com/144/" target="_blank">武炼巅峰</a></li><li>6<a href="http://www.kushubao.com/43209/" target="_blank">雪鹰领主</a></li><li>7<a href="http://www.kushubao.com/18949/" target="_blank">星战风暴</a></li><li>8<a href="http://www.kushubao.com/20333/" target="_blank">造化之门</a></li><li>9<a href="http://www.kushubao.com/3639/" target="_blank">流氓艳遇记</a></li><li>10<a href="http://www.kushubao.com/44129/" target="_blank">贞观帝师</a></li><li>11<a href="http://www.kushubao.com/29279/" target="_blank">一世之尊</a></li><li>12<a href="http://www.kushubao.com/512/" target="_blank">武神空间</a></li><li>13<a href="http://www.kushubao.com/9945/" target="_blank">灵域</a></li><li>14<a href="http://www.kushubao.com/29349/" target="_blank">帝霸</a></li><li>15<a href="http://www.kushubao.com/19835/" target="_blank">永夜君王</a></li><li>16<a href="http://www.kushubao.com/17057/" target="_blank">神级英雄</a></li><li>17<a href="http://www.kushubao.com/20294/" target="_blank">择天记</a></li><li>18<a href="http://www.kushubao.com/10190/" target="_blank">黑铁之堡</a></li><li>19<a href="http://www.kushubao.com/20010/" target="_blank">飞天</a></li><li>20<a href="http://www.kushubao.com/44964/" target="_blank">巫神纪</a></li><li>21<a href="http://www.kushubao.com/50221/" target="_blank">斗罗大陆3龙王传说</a></li><li>22<a href="http://www.kushubao.com/50283/" target="_blank">玄界之门</a></li><li>23<a href="http://www.kushubao.com/18957/" target="_blank">剑动山河</a></li><li>24<a href="http://www.kushubao.com/29216/" target="_blank">狂仙</a></li><li>25<a href="http://www.kushubao.com/29253/" target="_blank">异常生物见闻录</a></li><li>26<a href="http://www.kushubao.com/44342/" target="_blank">申公豹传承</a></li><li>27<a href="http://www.kushubao.com/36239/" target="_blank">天域苍穹</a></li><li>28<a href="http://www.kushubao.com/18662/" target="_blank">天择</a></li><li>29<a href="http://www.kushubao.com/20104/" target="_blank">佣兵的战争</a></li><li>30<a href="http://www.kushubao.com/40509/" target="_blank">人道至尊</a></li>
 

</ul>

 

我写这个"(\S+?)" target="_blank">(.*?)<
这个提取出来。他是每日推荐的。怎么取下面的奇幻类型,求大神解答

后面说下,我这个是要抓包提取部分内容的

加载中
0
Feng_Yu
Feng_Yu

html不要用正则去提取,应该用xpath或者html parser工具去解析

返回顶部
顶部