printf("remember, /* this isn't a comment */"); printf("/* This isn't a comment %s */", /* but this is */ "/* this isn +'t, though */); // /* The code between these lines int x = y + z; // is not commented out. The line level comments take precedent */
In short, this is a potentially nasty problem. I would strongly recommend you read the very excellent Mastering Regular Expressions from O'Reilly by Jeffrey Friedl.
Regardless, any solution you come up with using regexes will probably only operate on a carefully crafted subset of the data, so proceed with caution. There are also variations depending upon which implementation of C you're using.
In reply to Re: need regex help to strip things like embedded C comments
by jimt
in thread need regex help to strip things like embedded C comments
by Eradicatore
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |