From: Daniel Lucraft Date: 2007-09-19T21:17:41+09:00 Subject: Re: how can I remove all the comments in my c program. Sebastian Hungerecker wrote: > Vellingiri Arul wrote: >> Dear Friends, >> using The Ruby how can I remove all the comments in my c program. >> I have tried to do using the regular expression. > > If you want something that works reliably, you would need to use a > C-parser > rather than regular expressions. It is actually possible to do this reliably using regular expressions, but it's not straightforward. Try translating this into Ruby regexp: http://perldoc.perl.org/perlfaq6.html#How-do-I-use-a-regular-expression-to-strip-C-style-comments-from-a-file%3f best, Dan -- Posted via http://www.ruby-forum.com/.