Module:Replace
From Soyjak Wiki, the free ensoyclopedia
Jump to navigationJump to search
| This module is rated as ready for general use. It is considered stable and may be used wherever appropriate. Improvements should be developed and tested in a sandbox before changing the live module. |
local p = {}
function p.main(frame)
local args = frame:getParent().args
local haystack = args[1] or ""
local needle = args[2] or ""
local replacement = args[3] or ""
haystack = tostring(haystack)
needle = tostring(needle)
replacement = tostring(replacement)
local result = haystack:gsub(needle, replacement)
return result
end
return p