String:gsub()
The gsub method on a string uses Lua https://interfaceware.atlassian.net/wiki/spaces/IXB/pages/2693038082 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: