Sparse Regular Expression Matching

被引:0
|
作者
Bille, Philip [1 ]
Gortz, Inge Li [1 ]
机构
[1] Tech Univ Denmark, Lyngby, Denmark
关键词
ALGORITHM; COMPLEXITY; DERIVATIVES; FOLLOW;
D O I
暂无
中图分类号
TP301 [理论、方法];
学科分类号
081202 ;
摘要
A regular expression specifies a set of strings formed by single characters combined with concatenation, union, and Kleene star operators. Given a regular expression R and a string Q, the regular expression matching problem is to decide if Q matches any of the strings specified by R. Regular expressions are a fundamental concept in formal languages and regular expression matching is a basic primitive for searching and processing data. A standard textbook solution [Thompson, CACM 1968] constructs and simulates a nondeterministic finite automaton, leading to an O(nm) time algorithm, where n is the length of Q and m is the length of R. Despite considerable research efforts only polylogarithmic improvements of this bound are known. Recently, conditional lower bounds provided evidence for this lack of progress when Backurs and Indyk [FOCS 2016] proved that, assuming the strong exponential time hypothesis (SETH), regular expression matching cannot be solved in O((nm)(1-epsilon)), for any constant epsilon > 0. Hence, the complexity of regular expression matching is essentially settled in terms of n and m. In this paper, we take a new approach and introduce a density parameter, Delta, that captures the amount of nondeterminism in the NFA simulation on Q. The density is at most nm + 1 but can be significantly smaller. Our main result is a new algorithm that solves regular expression matching in O(Delta log log nm/Delta + n + m) time. This essentially replaces nm with Delta in the complexity of regular expression matching. We complement our upper bound by a matching conditional lower bound that proves that we cannot solve regular expression matching in time O(Delta(1-epsilon)) for any constant epsilon > 0 assuming SETH. The key technical contribution in the result is a new linear space representation of the classic position automaton that supports fast state-set transition computation in near-linear time in the size of the input and output state sets. To achieve this we develop several new insights and techniques of independent interest, including new structural properties of the parse trees of regular expression, a decomposition of state-set transitions based on parse trees, and a fast batched predecessor data structure.
引用
收藏
页码:3354 / 3375
页数:22
相关论文
共 50 条
  • [1] Greedy regular expression matching
    Frisch, A
    Cardelli, L
    AUTOMATA , LANGUAGES AND PROGRAMMING, PROCEEDINGS, 2004, 3142 : 618 - 629
  • [2] Benchmarking Regular Expression Matching
    Roodt, Alexander
    Watling, Brendan Keith Mark
    Bester, Willem
    van der Merwe, Brink
    Sung, Sicheol
    Han, Yo-Sub
    IMPLEMENTATION AND APPLICATION OF AUTOMATA, CIAA 2024, 2024, 15015 : 316 - 331
  • [3] Selective Regular Expression Matching
    Stakhanova, Natalia
    Ren, Hanli
    Ghorbani, Ali A.
    INFORMATION SECURITY, 2011, 6531 : 226 - +
  • [4] Faster Regular Expression Matching
    Bille, Philip
    Thorup, Mikkel
    AUTOMATA, LANGUAGES AND PROGRAMMING, PT I, 2009, 5555 : 171 - +
  • [5] Fast and compact regular expression matching
    Bille, Philip
    Farach-Colton, Martin
    THEORETICAL COMPUTER SCIENCE, 2008, 409 (03) : 486 - 496
  • [6] From regular expression matching to parsing
    Bille, Philip
    Li Gortz, Inge
    ACTA INFORMATICA, 2022, 59 (06) : 709 - 724
  • [7] Regular expression pattern matching for XML
    Hosoya, H
    Pierce, BC
    JOURNAL OF FUNCTIONAL PROGRAMMING, 2003, 13 : 961 - 1004
  • [8] Translating regular expression matching into transducers
    Sakuma, Yuto
    Minamide, Yasuhiko
    Voronkov, Andrei
    JOURNAL OF APPLIED LOGIC, 2012, 10 (01) : 32 - 51
  • [9] Regular Expression Matching in Reconfigurable Hardware
    Ioannis Sourdis
    João Bispo
    João M. P. Cardoso
    Stamatis Vassiliadis
    Journal of Signal Processing Systems, 2008, 51 : 99 - 121
  • [10] General parsing with regular expression matching
    Borsotti, Angelo
    Breveglieri, Luca
    Reghizzi, Stefano Crespi
    Morzenti, Angelo
    JOURNAL OF COMPUTER LANGUAGES, 2023, 74