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

Viktor Rosenfeld rosenfel at informatik.hu-berlin.de
Sun Feb 1 19:42:05 EST 2004


Hi,

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.

Thanks,
Viktor



More information about the Python-list mailing list