regex for C comments

Steve Kearns kearns at read.columbia.edu
Tue Jul 11 12:08:52 AEST 1989


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

does not match 

>  /***/
>(This one was easy. :-)

A guess it was not so easy.  "/***/" does indeed match the 
above regular expression:

"/*""/"*([^*/]|[^*]"/"|"*"[^/])*"*"*"*/"
       0                       0   1

Under each star I have listed how many times it iterates to match
"/***/".  

-steve



More information about the Comp.lang.c mailing list