F: How can I make re.sub() replace patterns across newlines

Viktor Rosenfeld rosenfel at informatik.hu-berlin.de
Mon Feb 2 01:42:05 CET 2004


I want to strip a JAVA file of /* */ like comments.  Unfortunately, the
simple regexp "\/\*.*\*\/" only works on comments, that are on one line. 
Is there a simple way to remove comments that go across several lines with
python regexp's?  I tried re.M to no avail.


More information about the Python-list mailing list