in reply to Re: Re: removing C style comments from text files
in thread removing C style comments from text files

That's kind of a chicken-and-egg problem, isn't? How can you succesfully remove strings, if you can't detect comments? Consider:
/* One " two */ a = b + 4; /* three " four */
You have to do it all in one pass. Something like:
s { ( [^"'/]* # Not a string, character o +r comment. | "[^\\"]*(?:\\.[^\\"]*)*" # String. | '[^\\']*(?:\\.[^\\']*)*' # Char. | / (?![*]) # Slash, not a comment. ) | ( /[*] [^*]* (?: [*] [^*/]* )* [*]/ ) # Comment. } { $2 ? "" : $1 }gsex;
But that isn't fool proof either (consider # define).

Abigail