A regular expression matching method and device based on deep learning, an electronic device and a storage medium

By combining a prediction model trained by deep learning with a DFA scanning engine, the speed bottleneck of traditional regular expression matching methods is solved, achieving efficient and accurate parallel text scanning, which is suitable for text data processing.

CN122173646APending Publication Date: 2026-06-09CHINA ELECTRONICS CORP 6TH RES INST

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA ELECTRONICS CORP 6TH RES INST
Filing Date
2026-03-06
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing regular expression matching methods based on deterministic finite automata suffer from processing speed bottlenecks due to serial scanning mechanisms, failing to meet the need for efficient screening of massive amounts of text, and exhibiting poor accuracy in parallel scanning.

Method used

A prediction model is trained using deep learning technology. By segmenting the text string into substrings and using the prediction model to output the initial DFA state value, the DFA scanning engine is combined to perform string scanning and concatenation, thereby improving the accuracy of parallel scanning.

Benefits of technology

It increases the probability of connecting sub-text states after text segmentation, avoids redundant calculations, and ensures the accuracy and efficiency of parallel scanning, especially significantly improving processing speed when scanning a large amount of text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122173646A_ABST
    Figure CN122173646A_ABST
Patent Text Reader

Abstract

This application provides a deep learning-based regular expression matching method, apparatus, electronic device, and storage medium. The method includes acquiring a text string to be processed and segmenting it into multiple text substrings; sequentially inputting the multiple text substrings into a pre-trained prediction model to obtain the initial state prediction results output by the prediction model, the initial state prediction results including the predicted initial DFA state value of each text substring; for each text substring, performing string scanning based on the predicted initial DFA state value of the text substring to obtain the corresponding regular expression scanning result; and determining whether the concatenation condition is satisfied based on the connection relationship between the scanning results corresponding to all text substrings to obtain the regular expression scanning result of the text string to be processed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and more specifically, to a method, apparatus, electronic device, and storage medium for regular expression matching based on deep learning. Background Technology

[0002] In applications such as text data hiding, the first step is to automatically and efficiently filter out text carriers that conform to specific format or grammatical rules from massive amounts of text. Regular expressions are the core technology for achieving this kind of pattern matching and filtering. However, when faced with massive amounts of data, current traditional regular expression matching methods based on deterministic finite automata suffer from severe processing speed bottlenecks due to their inherent serial scanning mechanism, failing to meet the requirements for efficient filtering. Although existing technologies typically employ parallel scanning to improve scanning speed, the accuracy of the scanning results is poor, and the connection probability is low. Summary of the Invention

[0003] The purpose of this application is to provide a deep learning-based regular expression matching method, apparatus, electronic device, and storage medium to improve the accuracy of parallel text scanning.

[0004] In a first aspect, the present invention provides a regular expression matching method based on deep learning. The method includes obtaining a text string to be processed and segmenting it into multiple text substrings; inputting the multiple text substrings sequentially into a pre-trained prediction model to obtain the initial state prediction result output by the prediction model, the initial state prediction result including the predicted initial DFA state value of each text substring; for each text substring, performing string scanning based on the predicted initial DFA state value of the text substring to obtain the corresponding regular expression scanning result; and determining whether the concatenation condition is satisfied based on the connection relationship between the scanning results corresponding to all text substrings to obtain the regular expression scanning result of the text string to be processed.

[0005] In an optional implementation, the step of determining whether the concatenation condition is met based on the connection relationship between the scan results corresponding to all text substrings, in order to obtain the regular expression scan result of the text string to be processed, specifically includes: The connection relationship of the scan results corresponding to adjacent text substrings is matched in sequence to determine whether the splicing conditions are met. If the conditions are met, the scan results corresponding to the text substrings are concatenated. If the condition is not met, the scan result corresponding to the next text substring is updated, and the process returns to perform the step of matching the connection relationship of the scan results corresponding to adjacent text substrings in sequence to determine whether the splicing condition is met.

[0006] In an optional implementation, it is determined whether the termination DFA state value of the scan result corresponding to the previous text substring is the same as the initial DFA state value of the scan result corresponding to the next text substring. If they are the same, then the splicing condition is met; If they are not the same, then the splicing conditions are not met.

[0007] In an optional implementation, the step of updating the scan result corresponding to the next text substring specifically includes: The initial DFA state value is set to the terminating DFA state value of the scan result corresponding to the previous text substring. The next text substring is then scanned again to obtain the updated scan result.

[0008] In an optional implementation, for each text substring, the text substring is input into the corresponding DFA scanning engine, and the string is scanned according to the target state transition rule based on the predicted initial DFA state value of the text substring to obtain the corresponding regular expression scanning result.

[0009] In an optional implementation, the prediction model is trained through the following steps: Obtain a sample long text, perform a serial scan of the sample long text, and record the DFA state value corresponding to each character position; Randomly extract fixed-length text segments from the scanning trajectory, and use the DFA state value corresponding to the starting position of the fixed-length text segment as the true initial state label to construct a training sample set consisting of text segments and initial state labels; Input text fragments from the training sample set into a deep neural network model, and output the predicted probability distribution of multiple initial DFA state values ​​for the experiment; The loss function value is calculated based on the difference between the predicted probability distribution and the true initial state label. The model parameters are updated through the backpropagation algorithm, and the training is iterated until the convergence condition is met, thus obtaining the trained prediction model.

[0010] Secondly, the present invention provides a regular expression matching device based on deep learning, the device comprising: The acquisition module is used to acquire the text string to be processed and split it into multiple text substrings; The prediction module is used to input multiple text substrings sequentially into a pre-trained prediction model to obtain the initial state prediction results output by the prediction model. The initial state prediction results include the predicted initial DFA state value for each text substring. The scanning module is used to perform string scanning for each text substring based on the predicted initial DFA state value of that text substring, so as to obtain the corresponding regular expression scanning result; The concatenation module is used to determine whether the concatenation conditions are met based on the connection relationship between the scan results corresponding to all text substrings, so as to obtain the regular expression scan result of the text string to be processed.

[0011] In an optional implementation, the splicing module is specifically used to match the connection relationship of the scan results corresponding to adjacent text substrings in sequence to determine whether the splicing conditions are met. If the conditions are met, the scan results corresponding to the text substrings are concatenated. If the condition is not met, the scan result corresponding to the next text substring is updated, and the process returns to perform the step of matching the connection relationship of the scan results corresponding to adjacent text substrings in sequence to determine whether the splicing condition is met.

[0012] Thirdly, the present invention provides an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the steps of any of the deep learning-based regular expression matching methods described in the foregoing embodiments.

[0013] Fourthly, the present invention provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of any of the deep learning-based regular expression matching methods described in the foregoing embodiments.

[0014] This application provides a deep learning-based regular expression matching method, apparatus, electronic device, and storage medium. The method includes acquiring a text string to be processed and segmenting it into multiple text substrings; sequentially inputting the multiple text substrings into a pre-trained prediction model to obtain the initial state prediction results output by the prediction model, the initial state prediction results including the predicted initial DFA state value for each text substring; for each text substring, performing string scanning based on the predicted initial DFA state value to obtain the corresponding regular expression scanning result; and determining whether the concatenation condition is met based on the connection relationship between the scanning results corresponding to all text substrings to obtain the regular expression scanning result of the text string to be processed. By using deep learning technology based on big data for initial DFA state prediction, the probability of direct connection between the corresponding states of each subtext after the text is segmented into subtexts is increased, ensuring the accuracy of parallel scanning. Attached Figure Description

[0015] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 A schematic diagram of a target state transition rule provided in an embodiment of this application; Figure 2 A flowchart illustrating a deep learning-based regular expression matching method provided in an embodiment of this application; Figure 3 A schematic diagram of the structure of a regular expression matching device based on deep learning provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0017] Regular expressions are the core technology for implementing such pattern matching and filtering. However, when faced with massive amounts of data, current traditional regular expression matching methods based on deterministic finite automata suffer from severe processing speed bottlenecks due to their inherent serial scanning mechanism, failing to meet the needs of efficient filtering.

[0018] Regular expression rules can be equivalently compiled into a deterministic finite automaton (DFA) for string scanning, such as... Figure 1 This is a schematic diagram of a target state transition rule provided in an embodiment of this application. When scanning the string T="abca", the process is a serial scan, resulting in low text scanning performance. Assuming the initial state is S0=1, the state changes during the scanning process are ( , , , , The state is (1, 2, 3, 5, 2). After scanning "abca", the state changes from the initial state. =1, became =2.

[0019] To accelerate string scanning performance, existing techniques typically employ a combination of parallel scanning and guessing to improve performance. For example, the text is divided into two segments, assuming each segment is... =“ab” and ="ca", then use DFA (for ease of understanding, we can think of two identical DFAs, which we will name respectively) , Simultaneously perform a scan, and then connect and confirm the scan results.

[0020] For example, The scan state changes as follows ( , , )=(1,2,3), in the process During the scan, if guessing The initial state is 3, then The scan state changes as follows ( , , =(3,5,2). Since final state ,and If the initial states are equal, then... and Direct connection results in (1,2,3,5,2), consistent with the serial scan result.

[0021] This performance improvement is achieved through parallel scanning. It's worth noting that if... If the result is not equal to 2, then the two scan results cannot be connected.

[0022] Based on this, this application proposes a parallel scanning method to improve the matching and execution speed of regular expressions in massive texts, thereby providing high-speed compliance carrier filtering capabilities for upper-layer applications (such as text data hiding).

[0023] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.

[0024] Example 1 In one embodiment of this application, a prediction model is provided. Here, the prediction model is obtained through the following steps: Obtain a long sample text and perform a serial scan, recording the DFA state value corresponding to each character position. Randomly extract fixed-length text segments from the scan trajectory, and use the DFA state value corresponding to the starting position of each segment as the true initial state label, constructing a training sample set consisting of text segments and initial state labels. Input the text segments from the training sample set into a deep neural network model, outputting a predicted probability distribution of multiple experimental initial DFA state values. Calculate the loss function value based on the difference between the predicted probability distribution and the true initial state label, and update the model parameters using the backpropagation algorithm. Iterate the training until the convergence condition is met to obtain the trained prediction model.

[0025] In one feasible implementation, a model such as BERT can be trained using a large-scale sample set. Each sample data is in the format of (initial state, input string), such as (0, "abcd"), (1, "bcda"), (3, "acda"), etc. The sample set comes from massive amounts of online text data and synthetic data. Each training sample is a (subtext, initial state) pair. Collecting a large sample set can increase the predictive ability of deep neural network prediction models for initial states.

[0026] During sample set construction, the complete text is first scanned serially using the DFA corresponding to the target regular expression set, recording the entire path state. Then, fixed-length sub-text segments are randomly extracted, and the true DFA state corresponding to their starting positions is used as the label, thus forming the supervised learning dataset. Construction process description: Collect or generate a large amount of long text T. Use a DFA compiled from the target regular expression set to perform a complete serial scan of each T, recording the DFA state at each character position.

[0027] From these scanning trajectories, a large number of fixed-length (e.g., m+1) text fragments were randomly sampled. And extract the DFA state corresponding to the starting position of the segment as its "true initial state" label. This forms the final training sample set {( , )}.

[0028] In one feasible implementation, a deep neural network architecture suitable for sequence data understanding and classification tasks can be selected, such as the Transformer-based BERT model or a variant thereof. The model is then weighted.

[0029] Text fragments from the training samples Convert the input to a format that the model can process. For example, tokenize the text and convert it into a sequence of corresponding word embedding vectors.

[0030] Input the sample The data is fed into a deep neural network model. Through its multiple nonlinear transformations, the model ultimately outputs a probability distribution P(S|) for all possible DFA states. ).

[0031] Compare the probability distribution predicted by the model with the true labels. (Usually represented as one-hot vectors) are compared, and a loss function is calculated. For this type of classification task, the cross-entropy loss function is used to measure the difference between the predicted probability distribution and the true distribution.

[0032] The backpropagation algorithm is used to calculate the gradient of the loss function with respect to the parameters of each layer of the model. Then, an optimization algorithm (such as Adam, SGD, etc.) is used to update the model weights based on the gradient to minimize the loss function. This process is iterative.

[0033] The entire training dataset {( , The data is input into the model in mini-batches, multiple epochs, for forward propagation, loss calculation, backpropagation, and parameter updates. The massive sample set ensures that the model can fully learn the complex mapping relationship from text fragments to the initial state, thereby continuously improving its predictive ability for the initial state.

[0034] Monitor model performance (e.g., prediction accuracy) on an independent validation set. When the model's performance on the validation set stabilizes or reaches the expected metrics, stop training and save the final model parameters. This trained model is then used for initial state prediction during the execution phase.

[0035] Example 2 Figure 2 This is a flowchart illustrating a deep learning-based regular expression matching method provided in an embodiment of this application. Figure 2 As shown in the embodiment of this application, a regular expression matching method based on deep learning is provided, including: S1. Obtain the text string to be processed and split it into multiple text substrings.

[0036] S2. Input multiple text substrings sequentially into the pre-trained prediction model to obtain the initial state prediction results output by the prediction model. The initial state prediction results include the predicted initial DFA state value for each text substring.

[0037] S3. For each text substring, perform a string scan based on the predicted initial DFA state value of the text substring to obtain the corresponding regular expression scan result.

[0038] In step S3, for each text substring, the text substring can be input into the corresponding DFA scanning engine, and the string can be scanned according to the target state transition rule based on the predicted initial DFA state value of the text substring to obtain the corresponding regular expression scanning result.

[0039] Based on the connection relationships between the scan results corresponding to all text substrings, it is determined whether the concatenation conditions are met, so as to obtain the regular expression scan result of the text string to be processed, specifically including: The connection relationships of the scan results corresponding to adjacent text substrings are matched sequentially to determine whether the concatenation conditions are met. Specifically, this includes: S4. Determine whether the termination DFA state value of the scan result corresponding to the previous text substring is the same as the initial DFA state value of the scan result corresponding to the next text substring.

[0040] S5. If they are the same, then the splicing condition is met.

[0041] S6. If they are not the same, then the splicing conditions are not met.

[0042] S7. If satisfied, then concatenate the scan results corresponding to the text substrings.

[0043] S8. If not satisfied, update the scan result corresponding to the next text substring and return to the step of matching the connection relationship of the scan results corresponding to adjacent text substrings in order to determine whether the splicing condition is satisfied.

[0044] Step S8, which involves updating the scan result corresponding to the next text substring, specifically includes: The initial DFA state value is set to the terminating DFA state value of the scan result corresponding to the previous text substring. The next text substring is then scanned again to obtain the updated scan result.

[0045] In one specific embodiment, the text string T can be divided into several ordered substrings. , (Here, it's divided into two substrings; in real-world scenarios, this isn't a strict limitation), resulting in an ordered set of substrings { , ,…, }, where n represents the text string T being divided into n segments, each segment having a length of m+1 characters; then the ordered substring set { , ,…, Input a deep neural network prediction model, and the deep neural network prediction model can simultaneously predict each substring in the ordered substring set. The most likely initial DFA state is { , , , ..., }, and distribute the ordered substrings to each DFA scanning engine in sequence. , ... Perform a string scan to obtain { , , , ..., }}、{ , , , ..., }}. . . { , , , ..., }

[0046] Next, from left to right, the initial and final states of each DFA scanning engine are evaluated sequentially. If two adjacent DFA scanning engines meet the connection condition (the final state of the previous DFA scanning engine scanning the substring is equal to the predicted initial state assigned to the next DFA scanning engine), then a connection is established. For example, ... = A direct connection yields { , , , ..., , , , , ..., Otherwise, the next DFA scanning engine (such as...) will be used. The initial state of the engine is reset to that of the previous engine (e.g., The final state of ) And use this initial state to process the substring Perform a rescan with a new state sequence { , ,…, Replace the original incorrect prediction result.

[0047] This application provides a deep learning-based regular expression matching method. By using deep learning technology based on big data to predict the initial state of DFA, it increases the probability that the corresponding states of each subtext are directly connected after the text is segmented into subtexts. This avoids the unnecessary computational overhead of rescanning, ensures the accuracy of parallel scanning, and greatly improves efficiency, especially when scanning a large amount of text.

[0048] Example 3 Figure 3 This is a schematic diagram of a deep learning-based regular expression matching device provided in an embodiment of this application. Figure 3 As shown, based on the same inventive concept, this application also provides a deep learning-based regular expression matching device 30, which includes: The acquisition module 310 is used to acquire the text string to be processed and split it into multiple text substrings; The prediction module 320 is used to input multiple text substrings sequentially into a pre-trained prediction model to obtain the initial state prediction results output by the prediction model. The initial state prediction results include the predicted initial DFA state value for each text substring. The scanning module 330 is used to perform string scanning for each text substring based on the predicted initial DFA state value of the text substring, so as to obtain the corresponding regular expression scanning result; The splicing module 340 is used to determine whether the splicing conditions are met based on the connection relationship between the scan results corresponding to all text substrings, so as to obtain the regular expression scan result of the text string to be processed.

[0049] In a preferred embodiment, the splicing module 340 is specifically used to match the connection relationship of the scanning results corresponding to adjacent text substrings in sequence to determine whether the splicing conditions are met; If the conditions are met, the scan results corresponding to the text substrings are concatenated. If the condition is not met, the scan result corresponding to the next text substring is updated, and the process returns to perform the step of matching the connection relationship of the scan results corresponding to adjacent text substrings in sequence to determine whether the splicing condition is met.

[0050] In a preferred embodiment, the splicing module 340 is specifically used to determine whether the termination DFA state value of the scan result corresponding to the previous text substring is the same as the initial DFA state value of the scan result corresponding to the next text substring. If they are the same, then the splicing condition is met; If they are not the same, then the splicing conditions are not met.

[0051] In a preferred embodiment, the splicing module 340 is specifically used for updating the scan result corresponding to the next text substring, specifically including: The initial DFA state value is set to the terminating DFA state value of the scan result corresponding to the previous text substring. The next text substring is then scanned again to obtain the updated scan result.

[0052] In a preferred embodiment, for each text substring, the scanning module 330 inputs the text substring into the corresponding DFA scanning engine, and performs string scanning according to the target state transition rule based on the predicted initial DFA state value of the text substring to obtain the corresponding regular expression scanning result.

[0053] In a preferred embodiment, the prediction model is trained through the following steps: Obtain a sample long text, perform a serial scan of the sample long text, and record the DFA state value corresponding to each character position; Randomly extract fixed-length text segments from the scanning trajectory, and use the DFA state value corresponding to the starting position of the fixed-length text segment as the true initial state label to construct a training sample set consisting of text segments and initial state labels; Input text fragments from the training sample set into a deep neural network model, and output the predicted probability distribution of multiple initial DFA state values ​​for the experiment; The loss function value is calculated based on the difference between the predicted probability distribution and the true initial state label. The model parameters are updated through the backpropagation algorithm, and the training is iterated until the convergence condition is met, thus obtaining the trained prediction model.

[0054] Please see Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 4 As shown, the electronic device 400 includes a processor 410, a memory 420, and a bus 430.

[0055] The memory 420 stores machine-readable instructions that can be executed by the processor 410. When the electronic device 400 is running, the processor 410 and the memory 420 communicate via the bus 430. When the machine-readable instructions are executed by the processor 410, they can perform the steps of a deep learning-based regular expression matching method as described in the above method embodiment. For specific implementation details, please refer to the method embodiment, which will not be repeated here.

[0056] This application also provides a computer-readable storage medium storing a computer program. When the computer program is run by a processor, it can execute the steps of a deep learning-based regular expression matching method as described in the above method embodiments. For specific implementation details, please refer to the method embodiments, which will not be repeated here.

[0057] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0058] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0059] Furthermore, the units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0060] Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0061] It should be noted that if the function is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0062] In this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, without necessarily requiring or implying any such actual relationship or order between these entities or operations.

[0063] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A regular expression matching method based on deep learning, characterized in that, The method includes: Obtain the text string to be processed and split it into multiple text substrings; Multiple text substrings are sequentially input into a pre-trained prediction model to obtain the initial state prediction results output by the prediction model. The initial state prediction results include the predicted initial DFA state value for each text substring. For each text substring, a string scan is performed based on the predicted initial DFA state value of that text substring to obtain the corresponding regular expression scan result; Based on the connection relationship between the scan results corresponding to all text substrings, determine whether the concatenation condition is met in order to obtain the regular expression scan result of the text string to be processed.

2. The method according to claim 1, characterized in that, The steps for determining whether the concatenation condition is met based on the connection relationships between the scan results corresponding to all text substrings, in order to obtain the regular expression scan result of the text string to be processed, specifically include: The connection relationship of the scan results corresponding to adjacent text substrings is matched in sequence to determine whether the splicing conditions are met. If the conditions are met, the scan results corresponding to the text substrings are concatenated. If the condition is not met, the scan result corresponding to the next text substring is updated, and the process returns to perform the step of matching the connection relationship of the scan results corresponding to adjacent text substrings in sequence to determine whether the splicing condition is met.

3. The method according to claim 2, characterized in that, Determine whether the termination DFA state value of the scan result corresponding to the previous text substring is the same as the initial DFA state value of the scan result corresponding to the next text substring. If they are the same, then the splicing condition is met; If they are not the same, then the splicing conditions are not met.

4. The method according to claim 3, characterized in that, The step of updating the scan result corresponding to the next text substring specifically includes: The initial DFA state value is set to the terminating DFA state value of the scan result corresponding to the previous text substring. The next text substring is then scanned again to obtain the updated scan result.

5. The method according to claim 1, characterized in that, For each text substring, the text substring is input into the corresponding DFA scanning engine. The predicted initial DFA state value of the text substring is used to perform string scanning according to the target state transition rule to obtain the corresponding regular expression scanning result.

6. The method according to claim 1, characterized in that, The prediction model is obtained through the following steps: Obtain a sample long text, perform a serial scan on the sample long text, and record the DFA state value corresponding to each character position; Randomly extract fixed-length text segments from the scanning trajectory, and use the DFA state value corresponding to the starting position of the fixed-length text segment as the true initial state label to construct a training sample set consisting of text segments and initial state labels; The text fragments in the training sample set are input into the deep neural network model, which outputs the predicted probability distribution of multiple initial DFA state values ​​for the experiment. The loss function value is calculated based on the difference between the predicted probability distribution and the true initial state label, and the model parameters are updated through the backpropagation algorithm. The training is iterated until the convergence condition is met, and the trained prediction model is obtained.

7. A regular expression matching device based on deep learning, characterized in that, The device includes: The acquisition module is used to acquire the text string to be processed and split it into multiple text substrings; The prediction module is used to input multiple text substrings sequentially into a pre-trained prediction model to obtain the initial state prediction results output by the prediction model. The initial state prediction results include the predicted initial DFA state value for each text substring. The scanning module is used to perform string scanning for each text substring based on the predicted initial DFA state value of that text substring, so as to obtain the corresponding regular expression scanning result; The concatenation module is used to determine whether the concatenation conditions are met based on the connection relationship between the scan results corresponding to all text substrings, so as to obtain the regular expression scan result of the text string to be processed.

8. The apparatus according to claim 7, characterized in that, The splicing module is specifically used to match the connection relationship of the scan results corresponding to adjacent text substrings in sequence to determine whether the splicing conditions are met. If the conditions are met, the scan results corresponding to the text substrings are concatenated. If the condition is not met, the scan result corresponding to the next text substring is updated, and the process returns to perform the step of matching the connection relationship of the scan results corresponding to adjacent text substrings in sequence to determine whether the splicing condition is met.

9. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to perform the steps of the deep learning-based regular expression matching method as described in any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the deep learning-based regular expression matching method as described in any one of claims 1 to 6.