Re: [MacPerl-AnyPerl] removing jsp-comments (c/c++/html)

[email protected] (Bart Lateur) Sat, 08 Dec 2001 00:10:47 +0100
Newsgroups perl.macperl.anyperl
Organization MediaMind
Message-ID <[email protected]>
On Fri, 07 Dec 2001 20:34:32 +0100, allan wrote:

>does anyone have a code snip lying around to remove c/c++
>and possibly html comments as used in jsp?

>it should be bullet proof enough to take care of the example below.

This question only makes me frown. According to the C standard, C style
comments CANNOT be nested, . Yet it looks to me as if that is what
you're asking for.

The only excuse you could have, is that there's a <% ... %> style tag
"inside" the comments, which might have to be treated specially.

Nested things cannot be treated with a regex alone. You need a (simple)
parser, one that balances out the delimiters. And since for comments the
delimiters needn't be balanced, e.g. this looks OK to me:

	/*    <%   */   %>

then, what you're asking for is not really possible. Or, you should
specify the rules better.

-- 
	Bart.