Ruby Conveniences

Posted by Tieg Zaharia Thu, 02 Feb 2006 07:49:00 GMT

Unbeknownst to me, there�s a quick way of doing a match & replace on a string in Ruby using just the brackets: (page 588 in the Ruby Book)

a = "bla bla bla"
a => "blA bla bla"

Unfortunately it only does one replace instead of a global replace, but I don�t know enough about RegExp�s now to know if there�s a way to do a global replace with this?

Posted in  | 3 comments