Module:Sandbox/MonkeysHK

local table = require('Module:Table') local checkType = require('Module:LibraryUtil').checkTypeLight local p = {}

- -- function: allMatched(s: string, t: table) -- -- Attempt to match each pattern in the table/subsequent args, -- then return true if all matches exists - function p.allMatched(s, ...) checkType('allMatched', 1, s, 'string') local t = { ... }	if t[1] == 'table' then t = t[1] end for _, v in ipairs(t) do		if not(s:match(v)) then return false end end return true end

- -- function: anyMatched(s: string, t: table) -- -- Attempt to match each pattern in the table/subsequent args, -- returns true if any match exists - function p.anyMatched(s, ...) checkType('anyMatched', 1, s, 'string') local t = { ... }	if t[1] == 'table' then t = t[1] end for _, v in ipairs(t) do		if s:match(v) then return true end end return false end

- -- function: gsubAll(s: string, t: table) -- -- Apply each pattern and replacements in the table/pairs of subsequent args, -- returns the replaced string - function p.gsubAll(s, ...) checkType('gsubAll', 1, s, 'string') local t = { ... }	if t[1] == 'table' then t = t[1] end return s end

p.gsubMulti = p.gsubAll

return p