Segmented DFA Regular Expression Matching Algorithm

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing regular expression matching algorithms are inefficient, particularly when using non-deterministic finite automata (NFAs) for text string analysis, as they can be slow due to backtracking and require excessive memory when using deterministic finite automata (DFAs) or hybrid NFA/DFA approaches.

Innovation Solution

The approach generates a 'segments DFA' data structure based on an NFA, allowing for skipping multiple characters during the matching process by precomputing auxiliary information about .* states and dynamically expanding segments, reducing memory usage and computational overhead.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Quantity of substance

If non-deterministic finite automata (NFAs) are used for regular expression matching, then memory usage is reduced, but matching speed deteriorates due to backtracking

Engineering Contradiction:
Improvememory usageVSAvoidmatching speed
Core Design Contradiction:
Quantity of substanceVSProductivity

Solution Approach 1:

The NFA is segmented into multiple states, and for each state, precomputation identifies the nearest .* states and minimal lengths to reach them. This segmentation allows the algorithm to process multiple characters at once by skipping intermediate states, thereby improving matching speed while maintaining NFA's memory efficiency.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The algorithm performs precomputation before matching to determine auxiliary information about .* states and minimal lengths for each NFA state. This preliminary action enables the matching phase to skip characters directly without backtracking, resolving the speed issue while keeping memory usage low.

Inventive Principle:
Principle #10Preliminary action

2Productivity

If deterministic finite automata (DFAs) are used for regular expression matching, then matching speed is improved, but memory usage increases excessively

Engineering Contradiction:
Improvematching speedVSAvoidmemory usage
Core Design Contradiction:
ProductivityVSQuantity of substance

Solution Approach 1:

Instead of converting the entire NFA to a DFA which would consume excessive memory, the algorithm applies DFA-like precomputation locally to each NFA state. This local quality approach provides DFA's speed benefits without requiring full DFA conversion, thus maintaining memory efficiency.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The algorithm creates a simplified copy of DFA concepts through precomputed auxiliary information (nearest .* states and minimal lengths) without implementing a full DFA. This copying approach captures the essential speed-improving characteristics of DFA while avoiding its memory overhead.

Inventive Principle:
Principle #26Copying

3Productivity

If hybrid NFA/DFA approaches are used, then matching performance is improved, but device complexity increases

Engineering Contradiction:
Improvematching performanceVSAvoidalgorithm complexity
Core Design Contradiction:
ProductivityVSDevice complexity

Solution Approach 1:

The algorithm extracts only the essential components needed for DFA-like performance (auxiliary information about .* states and minimal lengths) from the complex hybrid NFA/DFA approach. By taking out only what is necessary, the algorithm achieves improved performance without the full complexity of hybrid approaches.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The precomputation phase performs preliminary actions to calculate auxiliary information that simplifies the matching process. This preliminary action reduces the complexity during the actual matching phase by pre-determining skip distances and nearest .* states, making the overall algorithm more manageable.

Inventive Principle:
Principle #10Preliminary action

Data Source

PatentUS10242125B2Regular expression matching
Publication Date: 2019.03.26 MICRO FOCUS LLC
  • US10242125B2 patent drawing
  • US10242125B2 patent drawing
  • US10242125B2 patent drawing

AI summary

Example embodiments relate to regular expression matching. An example method may include generating a data structure based on a non-deterministic finite automaton (NFA) that represents a regular expression. The data structure may include a set of segments where each segment indicates a segment starting state of the NFA. Each segment may represent zero or more consecutive states of the NFA starting at the segment starting state. Different segments of the set of segments may be capable of indicating different segment starting states on the NFA. Each segment may represent a partial match of the regular expression to the string. The method may further include analyzing the string in relation to the NFA. The method may further include modifying the data structure as the string is analyzed. Such modification may include attempting to expand at least one of the segments in the set to represent additional states of the NFA.