pat = re.compile( "((!'and' .)* ...)+ -> drop3 {.*}", { drop3 = function(s) return string.sub(s, 1, -4) end } )