1. A computer-implemented method for configuring state machines used to order and select matching operations for determining whether an input string matches any of at least one regular expression, the computer-implemented method comprising: a) accepting the set of at least one regular expression; and b) for each of the at least one regular expression of the set accepted, 1) identifying any look-ahead type strings within the given regular expression, 2) identifying any sequential type strings within the given regular expression, 3) partitioning the regular expression based on any identified simple strings, any identified look-ahead type variable strings, and any sequential type variable strings to generate partitioned parts of the given regular expression, 4) reordering the partitioned parts of the given regular expression using optimization policies to generate reordered partitioned parts of the regular expression, and 5) configuring nodes of a state machine corresponding to the given regular expression, by recording configured information of the nodes on a tangible storage medium, using A) an order of the reordered partitioned parts of the regular expression, and B) a string type of the partitioned parts of the regular expression, wherein the optimization policies used to reorder the partitioned parts of the regular expression include a rule for placing a sequential type string part before an adjacent look-ahead type string part.