Method and device for matching regular expressions

A technology of expression matching and waiting to be matched, applied in the field of data processing, can solve the problems of slow matching speed and large storage space of DFA tables, and achieve the effect of improving matching speed and matching efficiency, reducing storage space, and reducing status

Inactive Publication Date: 2011-08-03
杨志杰
View PDF5 Cites 45 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0007] Because the DFA table has more complex rules (such as multiple .*), where . means any character, and * means any number of occurrences, the DFA table item is relatively large and takes up a lot of storage space, so the DFA engine is processing this The matching speed will be slower when the DFA table is planted

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and device for matching regular expressions
  • Method and device for matching regular expressions
  • Method and device for matching regular expressions

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0029] Embodiment 1 of the present invention provides a method for regular expression matching. figure 1 It is an overall flowchart of the regular expression matching method in Embodiment 1 of the present invention. like figure 1 As shown, the subject of execution of the method is a regular expression matching device provided in the embodiment of the present invention, and the method includes the following steps:

[0030] Step 100, load the message to be matched and the DFA state table of the deterministic finite automaton, the DFA state table includes a state transition table, which includes all state addresses in the regular expression matching process and links between each state A migration relationship, the above-mentioned migration relationship includes a matching condition and a next state that meets the matching condition. The above-mentioned address refers to a starting location where data corresponding to a certain state is stored in a storage medium, such as a cac...

Embodiment 2

[0078] Embodiment 2 of the present invention provides a regular expression matching device. Figure 8 It is a functional block diagram of a regular expression matching device according to Embodiment 2 of the present invention. like Figure 8 As shown, the device 200 includes:

[0079] The message and DFA table loading unit 210 is used to input the message to be matched and the DFA state table of the deterministic finite automaton. The DFA state table includes a state transition table, and the state transition table includes a regular expression matching process. All the state addresses of , and the migration relationship between each state, the migration relationship includes the matching condition and the next state that meets the matching condition;

[0080] The search unit 230 includes a data type determination module 231, a matching module 232 and an output module 234;

[0081] The data type determination module 231 is used to judge the data type corresponding to the cu...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The embodiment of the invention provides a method and device for matching regular expressions. The method comprises the following steps of: firstly, inputting a message to be matched and a DFA (Deterministic Finite Automaton) state table, wherein the DFA state table comprises a state transition table including transition relationships between all state addresses and each state in the matching process of the regular expressions; secondly, judging a data type corresponding to the present state, wherein the data type includes a single-character Char type and a multi-character Str type, and the data corresponding to the Str type are a plurality of continuous characters; if the data type is the Str type, matching a plurality of character values in the current state of the message to be matchedand the matching condition, and when matched, shifting to the next state satisfying the matching condition; if the data type is the Char type, matching a single character value at the current state in the message to be matched and the matching condition, and when matched, shifting to the next state satisfying the matching condition; and when the next state is an accept state, finishing the matching process and outputting a success result of matching. The method for matching regular expressions has high matching speed and high efficiency and the space occupied by the DFA items is small.

Description

technical field [0001] The invention relates to the field of data processing, in particular to a regular expression matching method and device. Background technique [0002] Regular expression (Regular Expression) is a tool used to describe a specific string. Its syntax is rich, and it can accurately and flexibly describe strings with various complex characteristics. The regular expression engine can, according to the characteristics described by the regular expression, find out a subset of strings that meet the characteristics from a given set of strings. [0003] The regular expression engine has a very wide range of uses, such as text search and replacement, file retrieval, etc. Complete specific content identification and filtering, network monitoring, protocol identification, flow detection and flow control, attack protection, virus detection, targeted advertising push and other functions. [0004] Usually, regular expressions can be compiled to generate NFA (Nondete...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F17/30
Inventor 徐敏锋付饶时立峰段国莲程贵锋
Owner 杨志杰
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products