{"id":690579,"date":"2020-09-09T19:42:38","date_gmt":"2020-09-10T02:42:38","guid":{"rendered":"https:\/\/www.microsoft.com\/en-us\/research\/?post_type=msr-research-item&p=690579"},"modified":"2022-07-15T14:09:48","modified_gmt":"2022-07-15T21:09:48","slug":"counting-set-automata","status":"publish","type":"msr-research-item","link":"https:\/\/www.microsoft.com\/en-us\/research\/publication\/counting-set-automata\/","title":{"rendered":"Regex Matching with Counting-Set Automata"},"content":{"rendered":"

We propose a solution to the problem of efficient matching regular expressions (regexes) with bounded repetition, such as (ab){1,100} , using deterministic automata. For this, we introduce novel counting set automata<\/em> <\/strong>(CsAs), automata with registers that can hold sets of bounded integers and can be manipulated by a limited portfolio of constant-time operations. We present an algorithm that compiles a large sub-class of regexes to deterministic CsAs. This includes (1) a novel Antimirov-style translation of regexes with counting to counting automata (CAs), nondeterministic automata with bounded counters, and (2) our main technical contribution, a determinization of CAs that outputs CsAs. The main advantage of this workflow is that the size of the produced CsAs does not depend on the repetition bounds used in the regex (while the size of the DFA is exponential to them). Our experimental results confirm that deterministic CsAs produced from practical regexes with repetition are indeed vastly smaller than the corresponding DFAs. More importantly, our prototype matcher based on CsA simulation handles practical regexes with repetition regardless of sizes of counter bounds<\/strong><\/em>. It easily copes with regexes with repetition where state-of-the-art matchers struggle.<\/p>\n