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