Kent Johnson wrote: >Use your compiled regex for the sub(), so it will have the DOTALL flag set: >html_text = p.sub(replace_string, html_text) > > Kent, I was trying to work out how to use the DOTALL flag with the sub method, but couldn't figure it out. It's so obvious once someone points it out. ;-) Many thanks, Frank