re.DOTALL

Irina Szabo irina at simbiosys.ca
Wed Nov 27 13:46:56 EST 2002


I need to remove all tags from  HTML files.

matchstr = re.compile(r'''<.*?>''',re.DOTALL|re.MULTILINE)
print matchstr.sub(" ", str )

The program works well for  tags located on one line,
but dosn't  delete tags if  the brackets <> are on different lines, like

<!--
body {  font-family: Arial, Helvetica, sans-serif; font-size: 10pt; color: 
#000000}
-->

What is wrong? 

Irina Szabo




More information about the Python-list mailing list