A system and method for searching data strings, such as network messages,
for one or more predefined regular expressions is provided. Regular
expressions are programmed into a pattern matching engine so that
multiple characters, e.g., 32, of the data strings can be searched at the
same time. The pattern matching engine includes a regular expression
storage device having one or more content-addressable memories (CAMs)
whose rows may be divided into sections. Each predefined regular
expression is analyzed so as to identify the "borders" within the regular
expression. A border is preferably defined to exist at each occurrence of
one or more predefined metacharacters, such as ".*", which finds any
character zero, one or more times. The borders separate the regular
expression into a sequence of sub-expressions each of which may be one or
more characters in length. Each sub-expression is preferably programmed
into a corresponding section of the pattern matching engine. The system
may also be configured so as to search multiple regular expressions in
parallel.