simple-sso/src/ssso_util.lua

19 lines
387 B
Lua

local function str_to_html(s)
s = s:gsub("&", "&")
s = s:gsub("<", "&#60;")
s = s:gsub(">", "&#62;")
s = s:gsub('"', "&#34;")
s = s:gsub('%%', "&#37;") -- avoid unwanted substitutions
return s
end
local function str_to_pattern(s)
s = s:gsub("([%(%)%%%.%+%-%*%?%^%$])", "%%%1")
return s
end
return {
str_to_html = str_to_html,
str_to_pattern = str_to_pattern,
}