Methods and apparatus for regular expression matching
First Claim
1. An apparatus for performing regular expression matching, the apparatus comprising:
- a matching mechanism configured to process the value of each character of a plurality of input characters in order to progressively generate matched indications in response to matching a keyword, base expression or non-keyword expression based on processing the values of said input characters; and
a matched regular expression detection mechanism, coupled to the matching mechanism, configured to receive said matched indications from the matching mechanism, to process said received matched indications based on their relative order to identify whether or not one or more regular expressions have been matched, and to generate one or more matched regular expression indications in response to said processing of said received matched indications identifying said one more regular expressions as being matched.
1 Assignment
0 Petitions
Accused Products
Abstract
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.
67 Citations
24 Claims
-
1. An apparatus for performing regular expression matching, the apparatus comprising:
-
a matching mechanism configured to process the value of each character of a plurality of input characters in order to progressively generate matched indications in response to matching a keyword, base expression or non-keyword expression based on processing the values of said input characters; and a matched regular expression detection mechanism, coupled to the matching mechanism, configured to receive said matched indications from the matching mechanism, to process said received matched indications based on their relative order to identify whether or not one or more regular expressions have been matched, and to generate one or more matched regular expression indications in response to said processing of said received matched indications identifying said one more regular expressions as being matched. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A method for performing regular expression matching in order to identify one or more matching expressions, the method comprising:
-
a first stage state machine processing the value of each character of a string of characters on which to perform matching, said processing including;
determining a next state of a state machine;
identifying for said determined next state whether there are any newly matched keywords, and if so, generating an indication of said newly matched keywords; and
identifying whether said determined next state is a final state, and if so, generating an indication of a base or non-keyword matching expression; anda second stage receiving said indications of the said newly matched keywords in the order generated and of the base or non-keyword matching expression, updating a keyword expression data structure based on said received indications of said newly matched keywords for all occurrences of said newly matched keywords in which all keywords preceding said newly matched keywords in an expression have been previously matched, and determining and generating indications of said one or more matching expressions based on the keyword expression data structure and said indications of base and non-keyword matching expressions. - View Dependent Claims (11, 12, 13, 14, 15)
-
-
16. An apparatus for performing regular expression matching in order to identify one or more matching expressions, the apparatus comprising:
-
a matching mechanism including;
means for processing the value of each character of a string of characters on which to perform matching, said means for processing including;
means for determining a next state;
means for identifying whether there are newly matched keywords, and if so, generating an indication of said newly matched keywords; and
means for identifying whether the next state is a final state, and if so, generating an indication of base and non-keyword matching expressions;a matched regular expression detection mechanism, coupled to the matching mechanism, configured to received said indications of the said newly matched keywords in the order generated and said indication of base and non-keyword matching expressions;
the matched regular expression detection mechanism including;
means for updating a keyword expression data structure based on said newly matched keywords for all occurrences in of said newly matched keywords in which all keywords preceding said newly matched keywords in an expression have been previously matched; and
means for determining and generating indications thereof said one or more matching expressions based on the keyword expression data structure and said indication of base and non-keyword matching expressions. - View Dependent Claims (17, 18)
-
-
19. An apparatus for performing regular expression matching, the apparatus comprising:
-
a matching mechanism configured to process the value of each character of a plurality of input characters in order to progressively generate one or more keyword indications of matched keywords when one or more matched keywords are identified; and a matched regular expression detection mechanism, coupled to the matching mechanism, and configured to receive said keyword indications of matched keywords from the matching mechanism and configured to generate one or more matched regular expression indications based on said received keyword indications in response to the matched regular expression detection mechanism identifying one or more regular expressions as being matched. - View Dependent Claims (20, 21, 22, 23, 24)
-
Specification