From: Florian Gross Date: 2003-12-19T08:48:32+09:00 Subject: Re: Yukihiro - Please ensure backwards compatibility Joseph Benik wrote: > blah.gsub!("testing", ' ') > i got a message that it was going to ignore(?) this statement as > "testing" was not a regexp..... this hit me on more than one script, > forcing me into a quick-fix mode as i definitely was not anticipating > this script-debilitating "ignore" of my code... Your statement won't be ignored, there will just be that warning. Why? Because "...bar".gsub(".", "foo") produces "foofoofoobar" and not "foofoofoofoofoofoo". This wasn't always this way -- in Ruby 1.6.8 Strings were handled just like Regexps in this case. I myself really prefer the current behaviour to the old one because the old one is still available (use /#{foo}/) and this allows you to easily substitute user input without using the longish Regexp.escape() which would be forgotten way to often and thus cause security risks anyway. The warning will go away in 1.9.0, AFAIK. I'd suggest either using /#{Regexp.escape(foo)}/ or disabling the warnings via the -W0-command-line-option or $-w = nil for now. Regards, Florian Gross