From: Alexandre Mutel Date: 2009-11-19T23:33:14+09:00 Subject: Re: How to strip ruby comments in a ruby line of code? Aldric Giacomoni wrote: > I'm still only learning regular expressions (I'll do another shameless > plug for rubular.com here), but you could do this: > string = string.match(/^.*#).to_s[0...-1] > > Yes, it's a poor solution, but should you have nothing else, it'll do. the problem with your solution is that this line of code will remove valid code : myvar_s = "#{myvar}" The problem is to handle correctly string escape sequence... it's possible, but it requires much more work... I just want to know if someone else did this?! -- Posted via http://www.ruby-forum.com/.