我对使用regex还比较陌生,正在尝试查找以下文本:
<div class="name">
<a href="/rd/?S=1401191307481569663391991831690328817&I=&DS=42639&T=55&U=http%3A%2F%2Fwww.spokeo.com%2Fmapview%2Fperson%2F18643819031%3Fpx%3D%26piplstart%3D%26q%3DJoe%2BHenderson%2C%2BPhoenix%2C%2BAZ%26g%3Dname_piplv2_scd_city01&P=">
<span class="highlight"> … </span>
T
<span class="highlight"> … </span>
, E Flower St,
<span class="highlight"> … </span>
,
<span class="highlight"> … </span>
,
<span class="highlight"> … </span>
, 50 years old
</a>
</div>
<div class="url">
www.spokeo.com/mapview/person/18643819031?px=&piplstart=&q=Joe+Hend...
</div>
我想到的表达方式是:
("<div class=\"name\">[\S\s]+</div><div class=\"url\">[\S\s]+</div>")
但是没有找到匹配项。感谢您的帮助。你知道吗
这里有一条新线:
但你的正则表达式中没有:
尝试在那里添加
\s*
(假设\s
在Python中包含新行,div
实际上总是紧跟在一起,中间只有空格)。你知道吗但是,如前所述,using regex to parse HTML is playing with fire。你知道吗
相关问题 更多 >
编程相关推荐