[CMake] Regular Expression to filter out C/C++ Comments

Andreas Lubensky theNfan at gmx.de
Mon Feb 22 10:28:54 EST 2010


Hello,
i'm having some trouble building a regular expression to filter out C and C++ style comments (//... /*...*/).
I constructed various regular expressions and also tried some i found on the web. But as soon as they are getting more sophisticated (e.g. being able to cope with additional * inside /*...*/), they all make CMake seg fault on some files. 
I could not track down the source of the crash inside the affected files, but they are all rather big (nearly 100KB - the rest is mostly smaller).
Unfortunately i can't just post the problematic files here, but i can post (one of) the regular expression i tried:

"((/\\*([^\\*]|(\\*+([^\\*/])))*\\*+/)|(//[^\r\n]*))"

Maybe someone has a regular expression at hand that is known to work?

CMake version is 2.8.0

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01


More information about the CMake mailing list