function parse(pattern) pattern = pattern :gsub("", "([^\"]*)") :gsub("", "([^\"]*)") :gsub("", "(.*)") return input:match("^"..pattern.."$") end if input == "" then return "" end cmdpattern = 'replace "" with "" in this text: ' pattern, replacement, text = parse(cmdpattern) if pattern then return text:gsub(pattern, replacement) -- simplest solution - no escaping for now else return("Error. Syntax: "..cmdpattern) -- for now return instead of error because error doesn't seem to work that great yet end