multiline regular expression (replace)

Zdenek Maxa zdenekmaxa at yahoo.co.uk
Tue May 29 05:03:57 EDT 2007


Hi all,

I would like to perform regular expression replace (e.g. removing 
everything from within tags in a XML file) with multiple-line pattern. 
How can I do this?

where = open("filename").read()
multilinePattern = "^<tag> .... <\/tag>$"
re.search(multilinePattern, where, re.MULTILINE)

Thanks greatly,
Zdenek



More information about the Python-list mailing list