Re: C++ Comments Longer than One Line.
[email protected] (Ralph Corderoy) Sun, 08 Oct 2006 12:01:07 +0100
| Newsgroups | perl.perlfaq.workers |
|---|---|
| Message-ID | <[email protected]> |
Hi Brian, > > http://www.ayni.com/perldoc/perl5.8.0/pod/perlfaq6.html#How-do-I-use-a-regular- > > expression-to-strip-C-style-comments-from-a-file- ends with "A > > slight modification also removes C++ comments". The suggested > > regexp doesn't work since C++ comments can be spread over more than > > one line by escaping the end of the line with a backslash. > > I've added a note to the answer saying the regex won't work for > continuation lines. If anyone wants to modify the regex to handle that > I can update the answer. > > The best solution is probably a line-reader that handles continuation > lines on its own. In Python, I'd add a negative look behind to check the character before this possible end of comment wasn't a backslash. ;-) Cheers, Ralph.