1. A method of classifying a binary string, comprising the steps of: a) searching for a plurality of classification fields in respective search trees based on a matching procedure in which an index value is obtained in a leaf node of a search tree for each classification field; b) deriving from the index values obtained in said searching step a policy to be applied to said data packet; and c) reducing the number of index values by combining intermediate results of said searching step or said deriving step.