localexport={}-- A helper function to escape magic characters in a string when interpolating a string into a Lua pattern.-- Magic characters: ^$()%.[]*+-?functionexport.pattern_escape(text)iftype(text)=="table"thentext=text.args[1]endtext=mw.ustring.gsub(text,"([%^$()%%.%[%]*+%-?])","%%%1")returntextend-- A helper function to escape magic characters in a string when interpolating a string into a Lua pattern replacement-- string (the right side of a gsub() pattern substitution call).-- Magic characters: %functionexport.replacement_escape(text)iftype(text)=="table"thentext=text.args[1]endtext=mw.ustring.gsub(text,"%%","%%%%")returntextendreturnexport