CN113704576B - Matching method, system and terminal based on visual regular expression rule - Google Patents
Matching method, system and terminal based on visual regular expression rule Download PDFInfo
- Publication number
- CN113704576B CN113704576B CN202111032140.3A CN202111032140A CN113704576B CN 113704576 B CN113704576 B CN 113704576B CN 202111032140 A CN202111032140 A CN 202111032140A CN 113704576 B CN113704576 B CN 113704576B
- Authority
- CN
- China
- Prior art keywords
- regular expression
- matching
- rule
- module
- expression
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 230000014509 gene expression Effects 0.000 title claims abstract description 296
- 230000000007 visual effect Effects 0.000 title claims abstract description 60
- 238000000034 method Methods 0.000 title claims abstract description 46
- 238000004519 manufacturing process Methods 0.000 claims abstract description 18
- 238000012800 visualization Methods 0.000 claims abstract description 15
- 238000007781 pre-processing Methods 0.000 claims description 31
- 238000001914 filtration Methods 0.000 claims description 27
- 230000015654 memory Effects 0.000 claims description 15
- 238000004590 computer program Methods 0.000 claims description 5
- 230000008569 process Effects 0.000 abstract description 11
- 238000012545 processing Methods 0.000 description 14
- 239000012634 fragment Substances 0.000 description 12
- 230000006870 function Effects 0.000 description 11
- 238000010586 diagram Methods 0.000 description 7
- 238000003860 storage Methods 0.000 description 5
- 238000010276 construction Methods 0.000 description 4
- 238000003491 array Methods 0.000 description 3
- 238000013461 design Methods 0.000 description 3
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004140 cleaning Methods 0.000 description 1
- 238000013501 data transformation Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000000605 extraction Methods 0.000 description 1
- 238000009472 formulation Methods 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/903—Querying
- G06F16/90335—Query processing
- G06F16/90344—Query processing by using string matching techniques
Abstract
The invention discloses a matching method, a matching system and a matching terminal based on a visual regular expression rule, which comprise the following steps: constructing one or more visualized regular expression rules based on one or more regular expression modules added in sequence; based on each constructed visual regular expression rule, a matching result corresponding to the file to be matched is obtained according to the file to be matched. According to the invention, one or more rules can be formulated according to the visualization module, so that the process is simple, the limit of professional skills is broken through, the use threshold of service personnel is reduced, regular expression rules can be produced efficiently and conveniently by group service personnel, matching results can be extracted, the modularized rule has high safety, confidentiality is facilitated, and the function of not containing a certain mode or character string can be realized; the rules formulated by the invention can be repeatedly utilized in different projects, so that the repeated labor capacity is greatly reduced, and the production efficiency is improved.
Description
Technical Field
The invention relates to the technical field of regular expression application, in particular to a matching method, a matching system and a matching terminal based on a visual regular expression rule.
Background
Regular expressions, also known as regular expressions, are a concept of computer science. Regular expressions are described using a single character, matching a series of strings that match some syntactic rule. In many application scenarios, regular expressions are typically used to retrieve, replacing text that matches a pattern.
Regular expressions are a part of computer science and must be computer-programmed in order to use them. However, more and more fields are currently treated by computers, but people have far from a grasp of the programming ability of a computer. This results in many of the problems that can be solved with regular expressions not being solved or solved poorly. The work processing efficiency is greatly reduced.
In addition, regular expressions are specific patterns composed of individual characters, each character having its specific meaning, and as the complexity of the problem to be processed becomes higher, the contents of the regular expressions become more and more difficult to read and understand. The multiplexing and maintenance difficulty of regular expression content becomes high. The regular expression also has a safety problem, the simple regular expression is a section of common character string, once the regular expression is leaked, the regular expression is easy to be used by others, and great potential safety hazards exist for the field with confidentiality requirements.
Still other functions are pure and the expression cannot be satisfied, such as not including a certain pattern or string. Since the design purpose of the regularization itself is retrieval, it is not supported for functions like this. There is indeed a need for such a process during use.
Disclosure of Invention
In view of the above-mentioned shortcomings of the prior art, the present invention aims to provide a matching method, a system and a terminal based on a visual regular expression rule, which are used for solving the problems that in the prior art, the difficulty of obtaining a regular expression by adopting computer programming is large, the content of a written regular expression is difficult to read, the security is not high, the confidentiality is not good, and the existing regular expression cannot meet the requirement of not containing a certain pattern or character string function.
To achieve the above and other related objects, the present invention provides a matching method based on a visualized regular expression rule, the method comprising: constructing one or more visualized regular expression rules based on one or more regular expression modules added in sequence; based on each constructed visual regular expression rule, a matching result corresponding to the file to be matched is obtained according to the file to be matched.
In an embodiment of the present invention, the constructing one or more visualized regular expression rules based on one or more regular expression modules added in turn includes: sequentially filling the contents of the added regular expression modules to obtain filling expression modules corresponding to the regular expression modules; wherein each fill expression module comprises: module parameter information; based on each filling expression module, one or more visualized regular expression rules are sequentially constructed; wherein each visualization regular expression rule corresponds to one or more padding expression modules.
In one embodiment of the present invention, the visualized regular expression rule includes: preprocessing rules and/or matching rules; wherein, the preprocessing rule is respectively corresponding to one or more preprocessing expression modules and a preprocessing filling expression module; the matching rules are respectively corresponding to one or more matching expression modules and matching filling expression modules.
In an embodiment of the present invention, the matching expression module includes: including a matching module and/or a non-matching module.
In an embodiment of the present invention, the matching module includes: one or more of a character module, a number module, and a keyword module; and/or, the non-including matching module includes: a non-character module, a non-number module, and a non-keyword module.
In an embodiment of the present invention, the module parameter information of the matched-pad expression module includes: matching content information, matching type information, and matching length information.
In an embodiment of the present invention, the preprocessing rule includes: splitting rules and/or filtering rules; wherein, the splitting rule is respectively corresponding to one or more splitting expression modules and splitting filling expression modules; the filtering rules are respectively corresponding to one or more filtering expression modules and filtering filling expression modules.
In an embodiment of the present invention, the obtaining, based on the constructed visualization regular expression rules, a matching result of the file to be matched according to the file to be matched includes: and executing each constructed visual regular expression rule, and sequentially obtaining output values corresponding to each visual regular expression rule according to the files to be matched to serve as a matching result of the files to be matched.
To achieve the above and other related objects, the present invention provides a matching system based on a visualized regular expression rule, the system comprising: the rule production unit is used for constructing one or more visual regular expression rules based on one or more regular expression modules which are added in sequence; and the matching unit is connected with the rule production unit and is used for obtaining a matching result corresponding to the file to be matched according to the file to be matched based on each constructed visual regular expression rule.
To achieve the above and other related objects, the present invention provides a matching terminal based on a visualized regular expression rule, including: a memory for storing a computer program; and the processor is used for executing the matching method based on the visualized regular expression rule.
As described above, the invention relates to a matching method, a matching system and a matching terminal based on a visual regular expression rule, which have the following beneficial effects: based on the modular design idea, one or more visual regular expression rules are formulated by adding one or more regular expression modules so as to obtain a matching result corresponding to the file to be matched; the user can formulate one or more rules according to the visualization module, the process is simple, the limit of professional skills is broken through, the use threshold of service personnel is reduced, the regular expression rules can be produced efficiently and conveniently by the group service personnel, the matching result is extracted, the modularized rule has high safety, the confidentiality is better, and the function of not containing a certain mode or character string can be realized; the rules formulated by the invention can be repeatedly utilized in different projects, so that the repeated labor capacity is greatly reduced, and the production efficiency is improved.
Drawings
FIG. 1 is a flow chart of a matching method based on a visualized regular expression rule in an embodiment of the invention.
FIG. 2 is a flow chart of a matching method based on a visualized regular expression rule in an embodiment of the invention.
FIG. 3 is a flow chart illustrating the execution of a visualized regular expression rule in an embodiment of the present invention.
FIG. 4 is a flow chart illustrating a method of constructing a visual regular expression rule in an embodiment of the present invention.
FIG. 5 is a schematic diagram of a matching system based on visualized regular expression rules in an embodiment of the invention.
Fig. 6 is a schematic structural diagram of a matching terminal based on a visualized regular expression rule in an embodiment of the present invention.
Detailed Description
Other advantages and effects of the present invention will become apparent to those skilled in the art from the following disclosure, which describes the embodiments of the present invention with reference to specific examples. The invention may be practiced or carried out in other embodiments that depart from the specific details, and the details of the present description may be modified or varied from the spirit and scope of the present invention. It should be noted that the following embodiments and features in the embodiments may be combined with each other without conflict.
The invention provides a matching method based on a visual regular expression rule, which comprises the steps of formulating one or more visual regular expression rules by adding one or more regular expression modules so as to obtain a matching result corresponding to a file to be matched; the user can formulate one or more rules according to the visualization module, the process is simple, the limit of professional skills is broken through, the use threshold of service personnel is reduced, the regular expression rules can be produced efficiently and conveniently by the group service personnel, the matching result is extracted, the modularized rule has high safety, the confidentiality is better, and the function of not containing a certain mode or character string can be realized; the rules formulated by the invention can be repeatedly utilized in different projects, so that the repeated labor capacity is greatly reduced, and the production efficiency is improved.
The embodiments of the present invention will be described in detail below with reference to the attached drawings so that those skilled in the art to which the present invention pertains can easily implement the present invention. This invention may be embodied in many different forms and is not limited to the embodiments described herein.
As shown in fig. 1, a flow diagram of a matching method based on a visualized regular expression rule in an embodiment of the present invention is shown.
The method comprises the following steps:
step S11: one or more visualization regular expression rules are constructed based on one or more regular expression modules added in sequence.
In detail, each visualized regular expression corresponds to one or more regular expression modules.
Optionally, step S11 includes: sequentially filling the contents of the added regular expression modules to obtain filling expression modules corresponding to the regular expression modules; wherein each fill expression module comprises: module parameter information; based on each filling expression module, one or more visualized regular expression rules are sequentially constructed; wherein each visualization regular expression rule corresponds to one or more padding expression modules. And wherein each filling expression module is also respectively filled by each regular expression module.
It should be noted that, the content of filling each regular expression module is determined according to the requirement, and the regular expression module is equivalent to a functional template, so long as we input the required content and/or implementation manner, the required filling module is obtained, so as to finally obtain the visual regular expression rule required to be formulated by us. Since each regular expression module is visible and the corresponding function is clear, the regular expression module is visualized; but since we fill in and the setting parameters when constructing each visualized regular expression rule are unknown, security is high and privacy is more favored.
Optionally, the regular expression module includes: one or more regular expressions; unlike a regular expression, a regular expression module can set more parameters, or a module with more logic relations can be obtained through content filling, for example, the original regular expression can only be matched in an inclusion mode, but we set the regular expression to be non-inclusion parameters so that the regular expression forms a module with non-inclusion functions.
Optionally, when multiple visual regular expression rules need to be formulated, one or more regular expression modules can be added in sequence, then content filling is performed sequentially in sequence to obtain a first visual regular expression rule, and then a second regular expression module is added to manufacture a second regular expression rule until all manufacture is completed; or firstly, sequentially filling regular expression modules for making the rule, and then sequentially constructing the rules by selecting the filled modules; the specific manner and order of construction is not limited in this application.
Optionally, each filling expression module is connected in series to obtain a visualized regular expression rule, and when the visualized regular expression rule is executed on the file to be matched, the data input by each filling expression module can be the file to be matched or the data output by any filling expression module, which is not limited in the application.
Optionally, the visualized regular expression rule includes: preprocessing rules and/or matching rules;
when the input files to be matched are required to be processed before being matched, a preprocessing rule is required to be formulated; the preparation process comprises the following steps:
sequentially filling the content of the added one or more preprocessing expression modules to obtain filling expression modules corresponding to the preprocessing expression modules; wherein each fill expression module comprises: module parameter information; sequentially constructing one or more preprocessing rules based on each preprocessing filling expression module; wherein, the preprocessing rule is respectively corresponding to one or more preprocessing expression modules and a preprocessing filling expression module.
Likewise, the matching rule making process includes:
sequentially filling the content of the added one or more matched expression modules to obtain filled expression modules corresponding to the matched expression modules; wherein each fill expression module comprises: module parameter information; sequentially constructing one or more matching rules based on each matching filling expression module; wherein, the matching rule is respectively corresponding to one or more matching expression modules and matching filling expression modules.
It should be noted that the preprocessing rule may implement preprocessing functions including, but not limited to, data cleaning, data integration, data protocol, and data transformation.
Optionally, the preprocessing rule includes: splitting rules and/or filtering rules; wherein, the splitting rule is respectively corresponding to one or more splitting expression modules and splitting filling expression modules; the filtering rules are respectively corresponding to one or more filtering expression modules and filtering filling expression modules.
The splitting rule is used for splitting the original text of the file to be matched. The document to be matched is content that the user needs to process, such as an article, a text, or the like. A piece of text may contain a lot of information, and different processing modes are required for the pieces containing different information. This requires the use of split rules. And formulating a splitting rule according to one or more splitting expression modules, splitting the original text of the file to be matched into a plurality of original text fragments according to the rule when the rule runs, and filtering the original text fragments in the next step before the original text fragments are used for extracting key information. The original text data with huge content is thinned, so that the information extraction efficiency is improved, and invalid matching actions are reduced.
The filtering rules can filter out unwanted data, leaving only valuable data. And formulating a filtering rule according to one or more filtering expression modules, and filtering the invalid data according to the content of the filtering rule in the rule running process, so that the matching consumption is reduced, and the invalid matching process is reduced. The filtered data will be used as input data for the next stage matching rule.
Optionally, in the process of splitting the original text of the file to be matched by using the splitting rule, a plurality of scattered original text fragments are generated, the fragments are not logically associated with the target content to be extracted, the required effective information is not contained, and the invalid fragments are filtered by using the filtering rule, so that only valuable original text fragments are left.
Alternatively, the matching rule is mainly responsible for retrieving and extracting related information, and the matching rule may be one or more pieces.
Optionally, when one or more original text segments corresponding to the file to be matched are obtained by executing the preprocessing rule, each input original text segment is matched with only one matching rule, and when the original text segment accords with a certain rule, an output value obtained by matching the original text segment under the certain rule is recorded. And then switching to the next original text for matching.
Optionally, the matching expression module includes: including a matching module and/or a non-matching module.
The non-included matching module is used for not acquiring the matched content; for example, the matching module matches "15" of the original text, and if the matching module has "15", a successful matching result is output; and the non-included matching module is used for matching the '15' of the original text, and if the matching is completed, the successful matching result is not output.
Optionally, the matching module includes: one or more of a character module, a number module, and a keyword module; and/or, the non-including matching module includes: a non-character module, a non-number module, and a non-keyword module.
Optionally, the module parameter information of the matched filling expression module includes: matching content information, matching type information, and matching length information.
The matching content information is content to be matched; the match type information is, for example, an inert match or a greedy match; the matching length information is the length of the matching content or the position of the file to be matched which needs to be matched.
Step S12: based on each constructed visual regular expression rule, a matching result corresponding to the file to be matched is obtained according to the file to be matched.
Optionally, the S12 includes: and executing each constructed visual regular expression rule, and sequentially obtaining output values corresponding to each visual regular expression rule according to the files to be matched to serve as a matching result of the files to be matched.
It should be noted that, the order of executing each visualized regular expression rule may be set according to the requirement, and the input data of each visualized regular expression rule may be the original text of the file to be matched, or may be the data output by any rule, which is not limited in this application.
Optionally, each visualized regular expression rule corresponds to an output value, which is collected only if the text matches the current rule. The output value can be a fixed value input by a user, or can be a result of extracting corresponding information in the original text according to rules.
Optionally, when the number of the matching rules is plural, each matching rule corresponds to an output value, and the output value may be a fixed value input by the user or a value extracted from the text information according to the matching rule.
For example, when the match is successful, 111 of the user inputs is output, and if not, 000 of the user inputs is output.
In order to better describe the matching system based on the visualized regular expression rules, specific embodiments are provided;
example 1; matching method based on visual regular expression rules. FIG. 2 is a flow chart of a matching method based on a visual regular expression rule.
When a new visual regular expression rule needs to be constructed, the following flow is carried out:
checking whether the code contains data of one or more required regular expression modules; if the data is included, converting each regular expression module into data of a visual mode of each regular expression module; if not, filling the data of each regular expression module and converting the data into the data of the visual mode; displaying data of the visualization modes of each regular expression module; sequentially adding one or more regular expression modules and filling corresponding contents to construct one or more visualized regular expression rules; executing each visual regular expression rule on the extracted source text, collecting and outputting the output result; judging whether the output result meets the expectation; if yes, ending the flow; if the rule is not met, continuing to add.
Example 2; matching method based on visual regular expression rules. A schematic flow diagram for executing a visualized regular expression rule is shown in fig. 3.
The method comprises the following steps:
(1) Rule construction step: constructing a splitting rule based on one or more splitting expression modules added in sequence; constructing a filtering rule based on one or more filtering expression modules added in sequence; a matching rule is constructed based on one or more matching expression modules added in sequence.
(2) Matching: inputting a source text, firstly executing the splitting rule, and splitting the source text into a plurality of original text fragments; inputting a plurality of original text fragments, executing a filtering rule, filtering invalid fragments, and only leaving valuable original text fragments; inputting valuable original text fragments, executing a matching expression module, and outputting a matching result.
Example 3; a construction method based on a visual regular expression rule. A flow diagram of a method of constructing a visualized regular expression rule is shown in fig. 4.
The method comprises the following steps: selecting a required functional module; filling the added functional modules with contents, filling matching contents which are not contained, and selecting whether the matching is inert or not so as to obtain filling expression modules of the functional modules; selecting whether to take the output value of the module as a matching output value; if the visual regular expression rule is selected as the output value, the visual regular expression rule is constructed; if not, continuing to add the functional module until the rule formulation is finished.
Similar to the principles of the embodiments described above, the present invention provides a matching system based on visualized regular expression rules.
Specific embodiments are provided below with reference to the accompanying drawings:
FIG. 5 shows a schematic structural diagram of a matching system based on a visualized regular expression rule in an embodiment of the invention.
The system comprises:
a rule production unit 51, configured to construct one or more visualized regular expression rules based on one or more regular expression modules that are sequentially added; wherein each visualization regular expression corresponds to one or more regular expression modules.
And the matching unit 52 is connected with the rule production unit 51 and is used for obtaining a matching result corresponding to the file to be matched according to the file to be matched based on each constructed visual regular expression rule.
It should be noted that, it should be understood that the division of the units in the embodiment of the system of fig. 5 is merely a division of a logic function, and may be fully or partially integrated into a physical entity or may be physically separated. And these units may all be implemented in the form of software calls through the processing element; or can be realized in hardware; the method can also be realized in a mode that part of the units are called by the processing element and software, and part of the units are realized in a hardware mode;
for example, each unit may be one or more integrated circuits configured to implement the above methods, e.g.: one or more application specific integrated circuits (Application Specific Integrated Circuit, abbreviated as ASIC), or one or more microprocessors (digital signal processor, abbreviated as DSP), or one or more field programmable gate arrays (Field Programmable Gate Array, abbreviated as FPGA), or the like. For another example, when a unit is implemented in the form of a processing element scheduler code, the processing element may be a general purpose processor, such as a central processing unit (Central Processing Unit, CPU) or other processor that may invoke the program code. For another example, the units may be integrated together and implemented in the form of a system-on-a-chip (SOC).
Optionally, the rule production unit 51 is configured to sequentially perform content filling on each added regular expression module, so as to obtain a filled expression module corresponding to each regular expression module; wherein each fill expression module comprises: module parameter information; based on each filling expression module, one or more visualized regular expression rules are sequentially constructed; wherein each visualization regular expression rule corresponds to one or more padding expression modules. And wherein each filling expression module is also respectively filled by each regular expression module.
Optionally, when multiple visual regular expression rules need to be formulated, one or more regular expression modules can be sequentially added through the rule production unit 51, then content filling is sequentially performed in order to obtain a first visual regular expression rule, and then a second regular expression module is added to make a second regular expression until all making is completed; or firstly, sequentially filling regular expression modules for making the rule, and then sequentially constructing the rules by selecting the filled modules; the specific manner and order of construction is not limited in this application.
Optionally, the rule production unit 51 is configured to connect each filling expression module in series to obtain a visualized regular expression rule, and when the visualized regular expression rule is executed on the file to be matched, the data input by each filling expression module may be the file to be matched, or may be the data output by any filling expression module, which is not limited in this application.
Optionally, the rule production unit 51 is configured to sequentially perform content filling on the added one or more pre-processing expression modules, so as to obtain a filled expression module corresponding to each pre-processing expression module; wherein each fill expression module comprises: module parameter information; sequentially constructing one or more preprocessing rules based on each preprocessing filling expression module; wherein, the preprocessing rule is respectively corresponding to one or more preprocessing expression modules and a preprocessing filling expression module.
Optionally, the rule production unit 51 is configured to sequentially perform content filling on the added one or more matching expression modules, so as to obtain a filled expression module corresponding to each matching expression module; wherein each fill expression module comprises: module parameter information; sequentially constructing one or more matching rules based on each matching filling expression module; wherein, the matching rule is respectively corresponding to one or more matching expression modules and matching filling expression modules.
Optionally, the preprocessing rule includes: splitting rules and/or filtering rules; wherein, the splitting rule is respectively corresponding to one or more splitting expression modules and splitting filling expression modules; the filtering rules are respectively corresponding to one or more filtering expression modules and filtering filling expression modules.
Optionally, the matching expression module includes: including a matching module and/or a non-matching module.
Optionally, the matching module includes: one or more of a character module, a number module, and a keyword module; and/or, the non-including matching module includes: a non-character module, a non-number module, and a non-keyword module.
Optionally, the module parameter information of the matched filling expression module includes: matching content information, matching type information, and matching length information.
Optionally, the matching unit 52 is configured to execute each constructed visualized regular expression rule, and sequentially obtain, according to the file to be matched, an output value corresponding to each visualized regular expression rule, so as to serve as a matching result of the file to be matched.
Optionally, each visualized regular expression rule corresponds to an output value, which is collected only if the text matches the current rule. The output value can be a fixed value input by a user, or can be a result of extracting corresponding information in the original text according to rules.
Optionally, when the number of the matching rules is plural, each matching rule corresponds to an output value, and the output value may be a fixed value input by the user or a value extracted from the text information according to the matching rule.
Fig. 6 shows a schematic structural diagram of a matching terminal 60 based on a visualized regular expression rule in an embodiment of the present invention.
The matching terminal 60 based on the visualized regular expression rule includes: a memory 61 and a processor 62, the memory 61 for storing a computer program; the processor 62 runs a computer program to implement a matching method based on the visualized regular expression rules as described in fig. 1.
Alternatively, the number of the memories 61 may be one or more, and the number of the processors 62 may be one or more, and one is taken as an example in fig. 6.
Optionally, the processor 62 in the matching terminal 60 based on the visual regular expression rule loads one or more instructions corresponding to the process of the application program into the memory 61 according to the steps as shown in fig. 1, and the processor 62 runs the application program stored in the first memory 61, so as to implement various functions in the matching method based on the visual regular expression rule as shown in fig. 1.
Optionally, the memory 61 may include, but is not limited to, high speed random access memory, nonvolatile memory. Such as one or more disk storage devices, flash memory devices, or other non-volatile solid-state storage devices; the processor 62 may include, but is not limited to, a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but also digital signal processors (Digital Signal Processing, DSP for short), application specific integrated circuits (Application Specific Integrated Circuit, ASIC for short), field-programmable gate arrays (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
Alternatively, the processor 62 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but also digital signal processors (Digital Signal Processing, DSP for short), application specific integrated circuits (Application Specific Integrated Circuit, ASIC for short), field-programmable gate arrays (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
The invention also provides a computer readable storage medium storing a computer program which when run implements the matching method based on the visualized regular expression rules as shown in fig. 1. The computer-readable storage medium may include, but is not limited to, floppy diskettes, optical disks, CD-ROMs (compact disk-read only memories), magneto-optical disks, ROMs (read-only memories), RAMs (random access memories), EPROMs (erasable programmable read only memories), EEPROMs (electrically erasable programmable read only memories), magnetic or optical cards, flash memory, or other type of media/machine-readable medium suitable for storing machine-executable instructions. The computer readable storage medium may be an article of manufacture that is not accessed by a computer device or may be a component used by an accessed computer device.
In summary, the matching method, the system and the terminal based on the visual regular expression rule, based on the modular design thought, formulate one or more visual regular expression rules by adding one or more regular expression modules so as to obtain a matching result corresponding to the file to be matched; the user can formulate one or more rules according to the visualization module, the process is simple, the limit of professional skills is broken through, the use threshold of service personnel is reduced, the regular expression rules can be produced efficiently and conveniently by the group service personnel, the matching result is extracted, the modularized rule has high safety, the confidentiality is better, and the function of not containing a certain mode or character string can be realized; the rules formulated by the invention can be repeatedly utilized in different projects, so that the repeated labor capacity is greatly reduced, and the production efficiency is improved. Therefore, the invention effectively overcomes various defects in the prior art and has high industrial utilization value.
The above embodiments are merely illustrative of the principles of the present invention and its effectiveness, and are not intended to limit the invention. Modifications and variations may be made to the above-described embodiments by those skilled in the art without departing from the spirit and scope of the invention. It is therefore intended that all equivalent modifications and changes made by those skilled in the art without departing from the spirit and technical spirit of the present invention shall be covered by the appended claims.
Claims (8)
1. A matching method based on a visual regular expression rule, the method comprising:
constructing one or more visualized regular expression rules based on one or more regular expression modules added in sequence;
based on each constructed visual regular expression rule, obtaining a matching result corresponding to a file to be matched according to the file to be matched;
wherein, based on the one or more regular expression modules added in turn, constructing one or more visualized regular expression rules includes: sequentially filling the contents of the added regular expression modules to obtain filling expression modules corresponding to the regular expression modules; wherein each fill expression module comprises: module parameter information; based on each filling expression module, one or more visualized regular expression rules are sequentially constructed; wherein, each visualization regular expression rule corresponds to one or more filling expression modules;
the obtaining the matching result of the file to be matched according to the file to be matched based on each constructed visual regular expression rule comprises the following steps: executing each constructed visual regular expression rule, and sequentially obtaining output values corresponding to each visual regular expression rule according to a file to be matched to serve as a matching result of the file to be matched;
the matching mode based on the visual regular expression rule comprises the following steps: checking whether the code contains data of one or more required regular expression modules; if the data is included, converting each regular expression module into data of a visual mode of each regular expression module; if not, filling the data of each regular expression module and converting the data into the data of the visual mode; displaying data of the visualization modes of each regular expression module; sequentially adding one or more regular expression modules and filling corresponding contents to construct one or more visualized regular expression rules; executing each visual regular expression rule on the extracted source text, collecting and outputting the output result; judging whether the output result meets the expectation; if yes, ending the flow; if the rule is not met, continuing to add.
2. The method of matching based on visualized regular expression rules of claim 1, wherein the visualized regular expression rules comprise: preprocessing rules and/or matching rules;
wherein, the preprocessing rule is respectively corresponding to one or more preprocessing expression modules and a preprocessing filling expression module; the matching rules are respectively corresponding to one or more matching expression modules and matching filling expression modules.
3. The method of matching based on visualized regular expression rules of claim 2, wherein the matching expression module comprises: including a matching module and/or a non-matching module.
4. A method of matching based on visualized regular expression rules as claimed in claim 3, wherein the comprising matching module comprises: one or more of a character module, a number module, and a keyword module; and/or, the non-including matching module includes: a non-character module, a non-number module, and a non-keyword module.
5. The visual regular expression rule-based matching method according to any of claims 1 to 4, wherein the module parameter information of the matching pad-expression module comprises: matching content information, matching type information, and matching length information.
6. The method for matching based on visualized regular expression rules according to claim 2, wherein the preprocessing rules include: splitting rules and/or filtering rules;
wherein, the splitting rule is respectively corresponding to one or more splitting expression modules and splitting filling expression modules;
the filtering rules are respectively corresponding to one or more filtering expression modules and filtering filling expression modules.
7. A matching system based on visualized regular expression rules, the system comprising:
the rule production unit is used for constructing one or more visual regular expression rules based on one or more regular expression modules which are added in sequence;
the matching unit is connected with the rule production unit and is used for obtaining a matching result corresponding to the file to be matched according to the file to be matched based on each constructed visual regular expression rule;
wherein, based on the one or more regular expression modules added in turn, constructing one or more visualized regular expression rules includes: sequentially filling the contents of the added regular expression modules to obtain filling expression modules corresponding to the regular expression modules; wherein each fill expression module comprises: module parameter information; based on each filling expression module, one or more visualized regular expression rules are sequentially constructed; wherein, each visualization regular expression rule corresponds to one or more filling expression modules;
the obtaining the matching result of the file to be matched according to the file to be matched based on each constructed visual regular expression rule comprises the following steps: executing each constructed visual regular expression rule, and sequentially obtaining output values corresponding to each visual regular expression rule according to a file to be matched to serve as a matching result of the file to be matched;
the matching mode based on the visual regular expression rule comprises the following steps: checking whether the code contains data of one or more required regular expression modules; if the data is included, converting each regular expression module into data of a visual mode of each regular expression module; if not, filling the data of each regular expression module and converting the data into the data of the visual mode; displaying data of the visualization modes of each regular expression module; sequentially adding one or more regular expression modules and filling corresponding contents to construct one or more visualized regular expression rules; executing each visual regular expression rule on the extracted source text, collecting and outputting the output result; judging whether the output result meets the expectation; if yes, ending the flow; if the rule is not met, continuing to add.
8. A matching terminal based on a visual regular expression rule, comprising:
a memory for storing a computer program;
a processor configured to perform the visual regular expression rule-based matching method of any of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111032140.3A CN113704576B (en) | 2021-09-03 | 2021-09-03 | Matching method, system and terminal based on visual regular expression rule |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111032140.3A CN113704576B (en) | 2021-09-03 | 2021-09-03 | Matching method, system and terminal based on visual regular expression rule |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113704576A CN113704576A (en) | 2021-11-26 |
CN113704576B true CN113704576B (en) | 2024-02-20 |
Family
ID=78659335
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111032140.3A Active CN113704576B (en) | 2021-09-03 | 2021-09-03 | Matching method, system and terminal based on visual regular expression rule |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113704576B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105916127A (en) * | 2016-06-27 | 2016-08-31 | 北京奇虎科技有限公司 | Method, device and server for obtaining user traffic information |
CN109408682A (en) * | 2018-10-30 | 2019-03-01 | 杭州安恒信息技术股份有限公司 | A kind of method of regular expression matching, system and equipment |
CN109918676A (en) * | 2019-03-18 | 2019-06-21 | 广东小天才科技有限公司 | It is a kind of to detect the method and device for being intended to regular expression, terminal device |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9152929B2 (en) * | 2013-01-23 | 2015-10-06 | Splunk Inc. | Real time display of statistics and values for selected regular expressions |
-
2021
- 2021-09-03 CN CN202111032140.3A patent/CN113704576B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105916127A (en) * | 2016-06-27 | 2016-08-31 | 北京奇虎科技有限公司 | Method, device and server for obtaining user traffic information |
CN109408682A (en) * | 2018-10-30 | 2019-03-01 | 杭州安恒信息技术股份有限公司 | A kind of method of regular expression matching, system and equipment |
CN109918676A (en) * | 2019-03-18 | 2019-06-21 | 广东小天才科技有限公司 | It is a kind of to detect the method and device for being intended to regular expression, terminal device |
Also Published As
Publication number | Publication date |
---|---|
CN113704576A (en) | 2021-11-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20230048032A1 (en) | Methods and systems for handling data received by a state machine engine | |
CN104067282B (en) | Counter operation in state machine lattice | |
CN104011723B (en) | Boolean logic in state machine lattice | |
CN103988212B (en) | Method and system for being route in state machine | |
CN103999035B (en) | Method and system for the data analysis in state machine | |
CN109388965B (en) | Desensitization method and system for mixed data | |
CN109460676A (en) | A kind of desensitization method of blended data, desensitization device and desensitization equipment | |
DE102013221125A1 (en) | System, method and computer program product for performing a string search | |
CN102867049A (en) | Chinese PINYIN quick word segmentation method based on word search tree | |
CN112906826A (en) | Multi-dimension-based knowledge graph fusion method and device and computer equipment | |
CN112733551A (en) | Text analysis method and device, electronic equipment and readable storage medium | |
JP2019204246A (en) | Learning data creation method and learning data creation device | |
CN115795061A (en) | Knowledge graph construction method and system based on word vectors and dependency syntax | |
CN110275889B (en) | Feature processing method and device suitable for machine learning | |
SE530514C2 (en) | A method, apparatus and computer software product in fingerprint matching | |
EP3336719A1 (en) | Future scenario generation device and method, and computer program | |
CN113704576B (en) | Matching method, system and terminal based on visual regular expression rule | |
Freund et al. | A formalization of membrane systems with dynamically evolving structures | |
CN111178701B (en) | Risk control method and device based on feature derivation technology and electronic equipment | |
CN107992526B (en) | Anchor recommendation method, storage device and computer device | |
CN110908780A (en) | Task combing method, device and equipment of scheduling platform and storage medium | |
CN113268485B (en) | Data table association analysis method, device, equipment and storage medium | |
CN116010662A (en) | Construction method, device and medium of energy consumption-carbon emission query system | |
CN111581162B (en) | Ontology-based clustering method for mass literature data | |
CN113342989A (en) | Knowledge graph construction method and device of patent data, storage medium and terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |