> 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.

thank you for the reply.
in jsp this is perfectly normal - it just so happens that
javascript also uses the c-style comments (as well as c++).
so you have
clientside comments mixed with serverside comments in the
same file (obviously resulting client-code would not include
the server-side comments).


> Nested things cannot be treated with a regex alone. 

i wasn't asking for a single regexp



> 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.

ok, they have to be balanced inside each language so to speak.
so in my example:


        if (i == 0) {
        /* javascript c-style
                var j = 10;
                // if (i == 1) {
                <%
                /*jsp c-style  */ <---- BALANCED jsp c-style
                int d = 100; // some java comments 
                %> 
        */ <---- BALANCED javascript c-style 
                var j = 11; // more javascript-comments
        }

Reply via email to