From: matz@... (Yukihiro Matsumoto) Date: 2000-03-17T02:04:29+09:00 Subject: [ruby-talk:01910] Re: Ruby Syntax similar to other languages? Hi, In message "[ruby-talk:01896] Ruby Syntax similar to other languages?" on 00/03/16, "David Douthitt" writes: |as a veteran vi user (and sed user) it was nothing for me to adjust to | | foo = s/this/that/g; | |but now with Ruby it seems this is | | foo.gsub!(/this/, "that") | |what? And if I don't want the "g" option, it's a completely different |function: | | foo.sub!(/this/, "that") | |and if I don't want the original to be modified: | | foo.sub(/this/, "that") | |Can someone explain why all this is? There must be a method to this madness.... |pun intended? sub/gsub is from awk. ! is inspired from scheme. I suggest not to use String's bang methods too much, at least while you are new to Ruby. bang means a little bit more danger than non bang. You can forget it, if you meet confusion. matz.