-- Simple find-and-replace that can be used on text templates so that there's less of a need for instances of nearly identical text.
-- Usage: {{#invoke:replace|replace|text|pattern to remove|pattern to insert}}
local p = {}
function p.replace(frame)
    text = frame.args[1]
    new_text, _ = string.gsub(text, frame.args[2], frame.args[3])
    return new_text
return p
Community content is available under CC-BY-SA unless otherwise noted.