From: Paul Lutus Date: 2006-09-14T02:30:43+09:00 Subject: Re: Regular expression question. L7 wrote: / ... > I dont think it applies to this directly. I didnt explicitly mention, > but the processing is happening on a line-by-line basis. In order to > remove all commenting in the above manner I would first have to read > the file as a string, strip, split on newline then parse code. Yes, and that may be the best way to approach this problem. There are a number of problems where reading the entire file and processing it as a long string is the best (one is tempted to say the only) way to proceed. If you don't read the entire file, then you are obliged to carry more state information in your algorithm between lines. IMHO, it is much better to eliminate multiline comments in one go than to construct and maintain state flags for this and any other contingencies that may carry over between lines. Obviously this poses practical problems for huge source files, but, again IMHO, huge source files should not exist anyway -- they should be broken up into manageable chunks. -- Paul Lutus http://www.arachnoid.com