-- input 1: replacement (content of "replacement" snippet) -- input 2: content (content of other snippet) -- -- probably does not handle special characters well... but should work for a first test _, _, from, to = replacement:find("s/(.*)/(.*)/") return content:gsub(from, to)