From: Vellingiri Arul Date: 2007-09-19T19:46:57+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. >> For example I have mentioned c program ,that may be ruby program >> for your purpose you assume. >> I have tried to do using the regular expression. >> But I was unable to find the anser for this. > > The most simple regexen would be %r(//.*$) to match single line comments > and %r(/\*.*?\*/)m to match multiline comments, but these will give you > some > false positives - for example, when you use // or /* inside a string. > If you want something that works reliably, you would need to use a > C-parser > rather than regular expressions. > > > HTH, > Sebastian Hai, very very thank you. I wil try to implement. by vellingiri. -- Posted via http://www.ruby-forum.com/.