A system and method directed to a matching engine for finding the best
match for an input string from among a group of predefined string
patterns is disclosed. The predefined patterns may include one or more
wildcard characters. A metric value is computed for every predefined
string pattern. If the input string matches more than one predefined
pattern, then the pattern with the highest metric value is determined as
the best match to the input string. Additionally, information of
different types may be attached to the predefined patterns and used for
further processing of information, for example, to make routing decisions
or to run a program module.