Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site uwvax.ARPA Path: utzoo!watmath!clyde!burl!ulysses!harpo!seismo!uwvax!anderson From: anderson@uwvax.ARPA Newsgroups: net.unix-wizards Subject: Comment recognition in Lex, again Message-ID: <245@uwvax.ARPA> Date: Thu, 3-May-84 18:41:08 EDT Article-I.D.: uwvax.245 Posted: Thu May 3 18:41:08 1984 Date-Received: Fri, 4-May-84 05:42:51 EDT Organization: U of Wisconsin CS Dept Lines: 20 <> I have received several replies to my request for a lex expression to recognize /* ... */ comments. The only one that works (sent in by Jim Hogue) is "/*"([^*]*"*"*"*"[^/*])*[^*]*"*"*"*/" which I can't claim to fully understand. Nor do I understand why my original, "/*"([^*]|("*"/[^/]))*"*/", doesn't work. The idea is that each character in the string between /* and */ can either be something other than *, or * followed by something other than /. Can anyone come up with an expression simpler than Hogue's that works? By "works", I mean put it in a real "lex" program, as in: (your expr) printf("recognized (%s)\n",yytext); and try it on inputs such as /***/, /*/*/, etc. -- David Anderson (uwvax!anderson)