Rapid pattern matching method and system based on pattern string intermediate characters and medium

By finding the middle characters of the pattern string in the target string and comparing the left and right characters, the problem of frequent characters comparisons in the prior art is solved, and efficient pattern matching and information retrieval is achieved.

CN120277243APending Publication Date: 2025-07-08HENAN VOCATIONAL COLLEGE OF APPLIED TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410242501.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-04
Publication Date
2025-07-08

Smart Images

  • Figure CN120277243A_ABST
    Figure CN120277243A_ABST
Patent Text Reader

Abstract

The invention provides a rapid pattern matching method and system based on a pattern string intermediate character and a medium, and belongs to the technical field of software engineering, and the method comprises the steps: obtaining a to-be-matched target string, and determining a pattern string and the intermediate character of the pattern string; searching all characters which are the same as the middle character of the pattern string in the target string, and determining the position of a first character which is the same as the middle character; sequentially comparing the left character and the right character of the middle character of the pattern string with the left character and the right character of the first character which is the same as the middle character found in the target string, if the characters are consistent, successfully matching, otherwise, searching a second character which is the same as the middle character of the pattern string in the target string, and determining the position of the character; comparing the left character and the right character of the character in sequence, and judging whether the matching is successful or not; repeatedly executing until the last character which is the same as the middle character of the pattern string is found in the target string, sequentially comparing the left character with the right character after the position of the last character is determined, if the characters are equal, matching succeeds, and if the characters are different, matching of the target string fails; and outputting the position of the pattern string character in the successfully matched target string. According to the method, the character comparison frequency in the execution process is greatly reduced, the algorithm execution efficiency is improved, and the time complexity of the algorithm is greatly reduced.
Need to check novelty before this filing date? Find Prior Art