[2.5] Regex doesn't support MULTILINE?
Gilles Ganault
nospam at nospam.com
Sat Jul 21 22:09:08 EDT 2007
Hello
I'm trying to extract information from a web page using the Re module,
but it doesn't seem to support MULTILINE:
=============
import re
#NO CRLF : works
response = "<b>Bla</b>blabla<font color=#123>"
#CRLF : doesn't work
response = "<b>Bla</b>blabla\r\n<font color=#123>"
pattern = "<b>Bla</b>.+?<font color=(.+?)>"
p = re.compile(pattern,re.IGNORECASE|re.MULTILINE)
m = p.search(response)
if m:
print m.group(1)
else:
print "Not found"
=============
Do I need to add something else to have Re work as intended?
Thank you.
More information about the Python-list
mailing list