add 'last' flag to abort further pattern matching