1. A method for inserting a string into a trie having a plurality of nodes, the method comprising: assigning a string including at least one sub-string to at least one node in the trie such that each sub-string is assigned to a corresponding node; for each sub-string, adding the sub-string to a character string, the sub-string identified by a starting position and a length in the character string; and for each node, storing at the node the starting position and the length of its corresponding sub-string.