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 difference is that sub only replaces the first occurrence of the pattern specified, whereas gsub does it for all occurrences (that is, it replaces globally).
sub
gsub