Methods and apparatus are disclosed for regular expression matching,
especially for, but not limited to high-speed applications such as in a
packet switching system (e.g., a router). One implementation includes a
matching mechanism for processing each character of a plurality of input
characters to progressively generate keyword indications of matched
keywords as matched keywords are identified, and for generating one or
more matching indications of matched base expressions and non-keyword
expressions. These indications are received by a matched regular
expression detection mechanism which generates one or more matched
regular expression indications based on said one or more keyword
indications and said one or more matching indications. In one
implementation, the matched regular expression detection mechanism
maintains a keyword data structure, which is updated as matched keyword
indications are received to ensure they are matched in a proper order.
One implementation uses a bitmap to track the matched keywords and
AND-SHIFT-OR operations to efficiently update the bitmap.