String:gsub()
The gsub method on a string uses Lua Pattern Matching to perform a find and replace operation.
It takes three arguments:
The pattern to be matched
Replacement string or function or table (ie. the pattern key)
Optional: The maximum number of matches to replace
gsub returns a copy of all occurrences of the pattern that have been replaced and the total number of matches that occurred.
Here are few examples for the different types of replacements: