Jump to content

Module:StringReplace

Wikipedia se
Badlao 13:16, 24 Farwari 2013 tak Inkbug (Baat | yogdaan) (fix) se

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 sting.gsub(str, escapePattern(strToFind), escapePattern(strToreplaceWith))
end
return p