--
local p =
-- exportable to other modulesfunction p._3way_check(text, args) if not text or text
-- Check if there is a match on the valid list for _, v in ipairs(args.valid) do if text:match(v) then return true, "" end end
-- Check if there is a match on the invalid list for k, v in pairs(args.invalid) do if text:match(k) then return false, v end end
-- if we've got this far, then there's no match return false, args.nomatchend
function p.test(frame) local title = frame.args.title or "" if title
local exceptionList = -- finish if the title has brackets that are part of the title (not disambiguation) for _, v in ipairs(exceptionList) do if v
-- extract the disambiguation text local disambiguation = string.match(title, "%s%((.-)%)")
-- set up the three possibilities local args =
local validmatch, msg = p._3way_check(disambiguation, args) if validmatch then return "Valid title" else return msg endend
return p