local gsub = mw.ustring.gsub local pattern_escape = require("Module:string/pattern escape") local replacement_escape = require("Module:string/replacement escape") return function(str, pattern, repl, n) return gsub(str, pattern_escape(pattern), replacement_escape(repl), n) end