On Mon, 16 Mar 2009 01:14:00 +0100, Gilles Ganault <nos...@nospam.com> wrote: >I'm stuck at why Python doesn't return the first line in this simple >regex
Found it: Python does extract the token, but displaying it requires removing hidden chars: ===== response = "<span>Address :</span></td>\r\t\t<td>\r\t\t\t3 Abbey Road, St Johns Wood <br />\r\t\t\tLondon, NW8 9AY\t\t</td>" re_address = re.compile('<span>Address :</span></td>.+?<td>(.+?)</td>',re.I | re.S | re.M) address = re_address.search(response) if address: address = address.group(1).strip() #Important! for item in ["\t","\r"," <br />"]: address = address.replace(item,"") print "address is %s" % address else: print "address not found" ===== HTH, -- http://mail.python.org/mailman/listinfo/python-list