BODY 发表于 2016-10-5 09:25:41

【求助】正则表达式相关,提取出网址一段一行列出

<div class="fl" id='vListTop'>
<div class="video"><a href="http://xhamster.com/movies/6420053/dripping_wet_down_my_thighs_masturbation_for_voyeurs.html" class="hRotator"><img src='http://txh.xhcdn.com/t/053/3_6420053.jpg' class='thumb' alt="Dripping wet down my thighs - Masturbation for Voyeurs"/><img class='hSprite' src='http://static-ec.xhcdn.com/images/spacer.gif' sprite='http://txh.xhcdn.com/t/053/s_6420053.jpg' id='6420053' onmouseover='hRotator.start2(this);'><b>01:21</b><u>Dripping wet down my thighs - Masturbation for Voyeurs</u></a><div class="hRate"><div class="fr">100%</div><div class="views-value">13,915</div></div></div><div class="video"><a href="http://xhamster.com/movies/6471894/dick_riding_practice_rose.html" class="hRotator"><img src='http://txh.xhcdn.com/t/894/2_6471894.jpg' class='thumb' alt="Dick Riding Practice Rose"/><img class='hSprite' src='http://static-ec.xhcdn.com/images/spacer.gif' sprite='http://txh.xhcdn.com/t/894/s_6471894.jpg' id='6471894' onmouseover='hRotator.start2(this);'><b>02:13</b><u>Dick Riding Practice Rose</u></a><div class="hRate"><div class="fr">100%</div><div class="views-value">7,746</div></div></div><div class="video"><a href="http://xhamster.com/movies/6500910/gabriela_r_01.html" class="hRotator"><img src='http://txh.xhcdn.com/t/910/5_6500910.jpg' class='thumb' alt="Gabriela R-01"/><img class='hSprite' src='http://static-ec.xhcdn.com/images/spacer.gif' sprite='http://txh.xhcdn.com/t/910/s_6500910.jpg' id='6500910' onmouseover='hRotator.start2(this);'><b>21:17</b><u>Gabriela R-01</u></a><div class="hRate"><div class="fr">99%</div><div class="views-value">45,169</div></div></div><div class='clear'></div><div class="video"><a href="http://xhamster.com/movies/6420533/puffy_pussy_private_show.html" class="hRotator"><img src='http://txh.xhcdn.com/t/533/1_6420533.jpg' class='thumb' alt="Puffy pussy Private Show"/><img class='hSprite' src='http://static-ec.xhcdn.com/images/spacer.gif' sprite='http://txh.xhcdn.com/t/533/s_6420533.jpg' id='6420533' onmouseover='hRotator.start2(this);'><b>07:39</b><u>Puffy pussy Private Show</u></a><div class="hRate"><div class="fr">98%</div><div class="views-value">10,242</div></div></div><div class="video"><a href="http://xhamster.com/movies/6491655/blonde_teen_and_hairless_pussy.html" class="hRotator"><img src='http://txh.xhcdn.com/t/655/1_6491655.jpg' class='thumb' alt="Blonde teen and hairless pussy"/><img class='hSprite' src='http://static-ec.xhcdn.com/images/spacer.gif' sprite='http://txh.xhcdn.com/t/655/s_6491655.jpg' id='6491655' onmouseover='hRotator.start2(this);'><b>08:57</b><u>Blonde teen and hairless pussy</u></a><div class="hRate"><div class="fr">95%</div><div class="views-value">41,813</div></div></div><div class="video"><a href="http://xhamster.com/movies/6402727/kitty_on_webcam.html" class="hRotator"><img src='http://txh.xhcdn.com/t/727/2_6402727.jpg' class='thumb' alt="kitty on webcam"/><img class='hSprite' src='http://static-ec.xhcdn.com/images/spacer.gif' sprite='http://txh.xhcdn.com/t/727/s_6402727.jpg' id='6402727' onmouseover='hRotator.start2(this);'><b>10:20</b><u>kitty on webcam</u><div class="hSpriteHD"></div></a><div class="hRate"><div class="fr">98%</div><div class="views-value">14,781</div></div></div><div class='clear'></div></div>


需求:上面文本中的href后面"。。。"双引号里的地址提取出来,一段一行列出,如下

http://xhamster.com/movies/6420053/dripping_wet_down_my_thighs_masturbation_for_voyeurs.html
http://xhamster.com/movies/6471894/dick_riding_practice_rose.html
http://xhamster.com/movies/6500910/gabriela_r_01.html


。会的朋友可能几分钟就写好了,对我从零开始学正则,估计几天也弄不出来。。。请坛友帮助写这样的工具,我把类似文本黏贴进去,点提取能出来这样一段一行的网址。。。最好是网页形式的,在浏览器中打开。。。

13631319474 发表于 2016-10-5 10:01:12

说说思路吧,以前搞java经常用
匹配规则大概就是
href="(*)"
括号里面是组,捕获组即可

lyytwenty 发表于 2016-10-5 11:25:39

X站。。。

BODY 发表于 2016-10-5 11:37:30

再请坛友帮助。。。

atexta 发表于 2016-10-5 14:17:51

href="([^"]+)"

BODY 发表于 2016-10-5 14:47:41

用了“正则表达测试器”,再参照atexta给的代码。。。

基本解决了我的需求。谢谢所有朋友:)

kelgood 发表于 2016-10-6 14:37:37

这个网站我曾经一天上800次!

BODY 发表于 2016-10-6 22:00:31

:):)撸管的话还是BEEG这个好

gger 发表于 2016-10-10 20:45:32

上的这么厉害啊
页: [1]
查看完整版本: 【求助】正则表达式相关,提取出网址一段一行列出