Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
C doesn't have nested comments, and your code example doesn't compile (in gcc at least. Maybe you have some odd compiler). Are you trying to find the nested comments and remove them so you have compilable code? If so, you'll need to do a lot more work and probably use a parser. For legal C comments, there is an answer in perlfaq6, " How do I use a regular expression to strip C style comments from a file", and it includes the regex from Jeffrey Friedl. If anyone has good information to add to that answer, send me the updates. :) Good luck :) Update: Correct perlfaq6 number, and, as ikegami notes, that FAQ deals with C comments, not nested comments. The OP said he had C source *shrug* In reply to Re: need regex help to strip things like embedded C comments
by brian_d_foy
|
|