1. A computerized method for identifying a complex string in a data stream, comprising: segmenting said complex string into a set of string segments and a suffix, each string segment comprising a prefix and a simple string, where said prefix comprises indefinite characters and said suffix comprises indefinite characters; generating an array of bitmasks, each bitmask associated with a string segment in said set of string segments, said bitmask indicating a location index of an end character of said each string segment; associating a Boolean state variable with said complex string; locating a current simple-matching position in said data stream at which at least one simple string belonging to said complex string terminates; initializing a current mask as an opaque mask; performing a logical OR operation of said current mask with selected bitmasks corresponding to said at least one simple string to produce a composite current mask; determining a gap between said current simple-matching position and a previous simple-matching position; left-shifting each entry of said state variable by said gap, replacing each shifted entry by “0” and setting the rightmost entry to “1”; and updating said state variable according to a logical AND operation with said composite current mask.