1. A method of matching a stream of characters against a predetermined regular expression, comprising: obtaining a transition table representing the regular expression as a graph comprising one or more input-conditional state transition specifications not limited to single-character inputs; generating a lookup table based on the transition table, the lookup table specifying a variable number n of characters to obtain from the character stream at each state of a state machine, wherein n is a non-negative integer not limited to 0 or 1; initializing a state machine; executing a lookup engine operative to, at each state of the state machine, retrieve the n characters specified in the lookup table for that state, and provide the n characters to a regex engine; and executing a regex engine operative to, at each state of the state machine, perform one of calculating a next state of the state machine based on the current state, the n characters received from the lookup engine, and the graph of state transition specifications, and terminating the method if all characters received from the lookup engine fail to match input conditions for all active state transition specifications or if a match succeeds.