I have been perusing the documentation for String today, and I saw the :sub method, which I\'d never noticed before. I\'ve been using :gsub
String
:sub
:gsub
The g stands for global, as in replace globally (all):
g
In irb:
>> "hello".sub('l', '*') => "he*lo" >> "hello".gsub('l', '*') => "he**o"