Search and Replace in Ruby

I tend to forgot about the existence of gsub when I try to perform a search and replace action in Ruby.

This note is in order to remember about gsub existence. That’s it.

sub only replaces the first occurrence of the given pattern, while gsub replaces every occurrence.

#ruby