Module:StringReplace
Appearance
Documentation for this module may be created at Module:StringReplace/doc
local p = {}
function escapePattern(text)
return string.gsub(text, "[%(%)%.%%%+%-%*%?%[%^%$]", "%%%1")
end
function p.replace_all(frame)
local str = frame.args[1]
local strToFind = frame.args[2]
local strToreplaceWith = frame.args[3]
return string.gsub(str, escapePattern(strToFind), escapePattern(strToreplaceWith))
end
return p