1. A method for encoding an input string, comprising: specifying a plurality of indexing domains in a finite-state network; each indexing domain having a delimited set of states and transitions that corresponds to a class of substring; and applying the finite-state network to the input string to produce a set of labeled indices; the label of each labeled index in the set of labeled indices identifying a class of substring and its associated index identifying a unique substring in the identified class; wherein each labeled index in the set of labeled indices corresponds to one of the indexing domains in the finite-state network.