Regexp-problem
Rikard Bosnjakovic
bos at hack.org
Fri Jun 15 00:36:06 EDT 2001
I have some problem with a regexp.
re.compile(r'^<tr bgcolor=.*html">(.*?)</a></td><td>(.*° F /
.*° C).* hPa</td><td>(.*?)</td>.*')
That line matches:
<tr bgcolor=#FFFFFF ><td ><a href="/global/stations/48839.html">Bach
Long Vi</a></td><td>81° F / 27° C</td><td>83%</td><td>1005
hPa</td><td>Partly Cloudy</td><td>07:00 AM ICT</td><td><a
href=/cgi-bin/addfav=00000.48839><img src="/graphics/ADD.gif" WIDTH=30
HEIGHT=16 BORDER=0></a></td></tr>
but not:
<tr bgcolor=#ffffff ><td ><a
href="/US/CA/Alturas.html">Alturas</a></td><td>73° F / 23°
C</td><td>20%</td><td>30.03 in / 1016 hPa</td><td>Clear</td><td>7:56 PM
PDT</td><td><pre> </pre></td><td><a href=/cgi-bin/addfav=96101.1><img
src="/graphics/ADD.gif" WIDTH=30 HEIGHT=16 BORDER=0></a></td></tr>
In case the lines got split, they should be on the same line.
The regexp seem to fail near the temperature on the second one, but I
can't see why since it's the same as the first one.
Ideas?
--
Rikard Bosnjakovic - http://bos.hack.org/cv/ - ICQ: 1158217
Anyone sending unwanted advertising e-mail to my address will be
charged $250 for network traffic and computing time. By extracting my
address from this message or its header, you agree to these terms.
More information about the Python-list
mailing list