Re: C++ Comments Longer than One Line.

[email protected] (brian d foy) Sat, 07 Oct 2006 15:42:14 -0500
Newsgroups perl.perlfaq.workers
Message-ID <071020061542142974%[email protected]>
[[ This message was both posted and mailed: see
   the "To," "Cc," and "Newsgroups" headers for details. ]]

In article <[email protected]>, Ralph
Corderoy <[email protected]> wrote:

> Hi,
> 
> [I'm not subscribed, so please CC me.]
> 
>
> 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.