crosstable.love/0029-do_if_match

6 lines
145 B
Plaintext

do_if_match = function(line, pat, f)
local captures = {line:match(pat)}
if #captures == 0 then return end
f(unpack(captures))
return true
end