From: Tom Copeland Date: 2006-09-15T11:15:17+09:00 Subject: Re: Regular expression question. On Thu, 2006-09-14 at 05:49 +0900, Robert Dober wrote: > On 9/13/06, Paul Lutus wrote: > I am intrigued, I believe that the regular expression to find all comments > in C must be very complex and probably not the correct tool, look at these > snipplets > > // /* > if(strcmp(x,"*/") > // "*/ > etc. etc. I'm not sure if it's impossible to parse out C-style comments using a regular expression, but the various JavaCC grammars I've seen all use lexical states to do it instead. Another complication is trigraphs (*), although I think those are unrecognized by default in most C preprocessors. Yours, Tom (*) http://en.wikipedia.org/wiki/C_trigraph