IP Library Granted Patent US 8,051,085
Granted Patent B1
US 8,051,085 · App. 12/505,372 · Granted Nov 1, 2011

Determining regular expression match lengths

Assignee: NetLogic Microsystems, Inc.
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 8,051,085
App. No.
12/505,372
Granted
Nov 1, 2011
Kind
B1
Abstract

A method and apparatus are disclosed for determining the lengths of one or more substrings of an input string that matches a regular expression (regex) The input string is searched for the regex using an non-deterministic finite automaton (NFA), and upon detecting a match state a selected portion of the input string is marked as a match string. The NFA is inverted to create a reverse NFA that embodies the inverse of the regex. For some embodiments, the reverse NFA is created by inverting the NFA such that the match state of the NFA becomes the initial state of the reverse NFA, the initial state of the NFA becomes the match state of the reverse NFA, and the goto transitions of the NFA are inverted to form corresponding goto transitions in the reverse NFA. The match string is reversed and searched for the inverted regex using the reverse NFA, and a counter is incremented for each character processed during the reverse search operation. The current value of the counter each time the match state in the reverse NFA is reached indicates the character length of a corresponding substring that matches the regex.

Claims (33)

1. A method of determining lengths of one or more substrings within an input string of characters that matches a regular expression embodied by a non-deterministic finite state automaton (NFA) stored in a search system including a forward search engine, a reverse search engine, and an inversion circuit, the method comprising:

comparing the input string with the regular expression using the NFA in a forward search operation performed in the forward search engine;

detecting a match state in the NFA in the forward search engine;

selecting a portion of the input string as a match string in response to the match state;

inverting the NFA to create a reverse NFA that embodies an inverted regular expression;

reversing the match string using the inversion circuit to create a reverse match string;

comparing the reverse match string with the inverted regular expression using the reverse NFA in a reverse search operation performed in the reverse search engine; and

incrementing a count value in response to each character processed in the reverse search operation performed in the reverse search engine.

2. The method of claim 1 , wherein the NFA comprises an initial state and a number of intermediate states between the initial state and the match state, and wherein the match state of the NFA corresponds to an initial state of the reverse NFA.

3. The method of claim 2 , wherein the initial state of the NFA corresponds to a match state of the reverse NFA.

4. The method of claim 3 , further comprising:

storing the count value each time the match state of the reverse NFA is reached during the reverse search operation, wherein each stored count value indicates the character length of a corresponding matching substring.

5. A system for determining lengths of one or more substrings within an input string of characters that matches a regular expression embodied by a non-deterministic finite state automaton (NFA), comprising:

means for comparing the input string with the regular expression using the NFA in a forward search operation;

means for detecting a match state in the NFA;

means for selecting a portion of the input string as a match string in response to the match state;

means for inverting the NFA to create a reverse NFA that embodies an inverted regular expression;

means for reversing the match string to create a reverse match string;

means for comparing the reverse match string with the inverted regular expression using the reverse NFA in a reverse search operation; and

means for incrementing a count value in response to each character processed in the reverse search operation.

6. The system of claim 5 , wherein the NFA comprises an initial state and a number of intermediate states between the initial state and the match state, and wherein the match state of the NFA corresponds to an initial state of the reverse NFA.

7. The system of claim 6 , wherein the initial state of the NFA corresponds to a match state of the reverse NFA.

8. The system of claim 7 , further comprising:

means for storing the count value each time the match state of the reverse NFA is reached during the reverse search operation, wherein each stored count value indicates the character length of a corresponding matching substring.

9. A system for determining lengths of one or more substrings within an input string of characters that matches a regular expression embodied by a non-deterministic finite state automaton (NFA), comprising:

a search engine configured to compare the input string with the regular expression to identify a match string that contains the one or more substrings that match the regular expression;

an inversion circuit coupled to the search engine and configured to invert the match string to create a reverse match string;

a reverse search engine configured to compare the reverse match string with an inverted regular expression that embodies a reverse NFA; and

a counter circuit coupled to the reverse search engine and configured to increment a count value upon each compare cycle in the reverse search engine, wherein the counter circuit outputs the count value each time a match condition is detected in the reverse search engine.

10. The system of claim 9 , wherein each count value output by the counter circuit indicates the number of characters in a corresponding one of the matching substrings.

11. The system of claim 9 , wherein the NFA comprises an initial state and a number of intermediate states between the initial state and the match state, and wherein the match state of the NFA corresponds to an initial state of the reverse NFA.

12. The system of claim 11 , wherein the initial state of the NFA corresponds to a match state of the reverse NFA.

13. The system of claim 9 , wherein the search engine comprises a first content addressable memory (CAM) device, and the reverse search engine comprises a second CAM device.

Assignments (6)
TERMINATION AND RELEASE OF SECURITY INTEREST IN PATENTS Recorded Feb 3, 2017
From: BANK OF AMERICA, N.A., AS COLLATERAL AGENT
To: BROADCOM CORPORATION
Reel/Frame 041712/0001 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Feb 1, 2017
From: BROADCOM CORPORATION
To: AVAGO TECHNOLOGIES GENERAL IP (SINGAPORE) PTE. LTD.
Reel/Frame 041706/0001 →
PATENT SECURITY AGREEMENT Recorded Feb 11, 2016
From: BROADCOM CORPORATION
To: BANK OF AMERICA, N.A., AS COLLATERAL AGENT
Reel/Frame 037806/0001 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 16, 2015
From: NETLOGIC I LLC
To: BROADCOM CORPORATION
Reel/Frame 035443/0763 →
CHANGE OF NAME Recorded Apr 16, 2015
From: NETLOGIC MICROSYSTEMS, INC.
To: NETLOGIC I LLC
Reel/Frame 035443/0824 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Aug 10, 2009
From: SRINIVASAN, MAHESHWARAN; STAROVOYTOV, ALEXEY
To: NETLOGIC MICROSYSTEMS, INC.
Reel/Frame 023073/0305 →
Continuity (1)
Provisional Application 61082051 · Jul 18, 2008