regex for C comments (Found a loophole?)

Greg Onufer greg at uop.EDU
Wed Jul 12 09:00:55 AEST 1989


kearns at read.columbia.edu (Steve Kearns) writes:

>A previous article claimed that 
>>| ----------------------------------------
>>| "/*""/"*([^*/]|[^*]"/"|"*"[^/])*"*"*"*/"
>>| ----------------------------------------

I believe that 

"/*""/"*([^*/]|[^*]"/"|"/*"|"*"[^/])*"*"*"*/"
                       +++++
will work better.

Try   "/* * /* */"  with the previous regex...
I could not claim to know whether or not it is a legal comment, but
the previous regex DOES pass "/* /* */".

Cheers!greg



More information about the Comp.lang.c mailing list