Determining regular expression match lengths
US8051085B1 · kind B1 · utility
Assignee
Inventors
Key dates
| Filing date | Jul 17, 2009 |
| Grant date | Nov 1, 2011 |
| Priority date | — |
| Expiry date | Jun 1, 2030 |
Classification
- Technology area (CPC H)Electricity
- CPC primaryH04L63/0245
- WIPO fieldDigital communication
- WIPO sectorElectrical engineering
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.
Source: USPTO / EPO open patent data. Objective bibliographic and citation counts.