Exploiting Structure in Regular Expression Queries
Ling Zhang, Shaleen Deep, Avrilia Floratou, Anja Gruenheid, Jignesh M. Patel, Yiwen Zhu
Abstract
Regular expression, or regex, is widely used to extract critical information from a large corpus of formatted text by finding patterns of interest. In tasks like log processing, the speed of regex matching is crucial. Data scientists and developers regularly use regex libraries that implement optimized regular expression matching using modern automata theory. However, computing state transitions in the underlying regex evaluation engine can be inefficient when a regex query contains a multitude of string literals. This inefficiency is further exasperated when analyzing large data volumes. This paper presents BLARE, Blazingly Fast Regular Expression, a regular expression matching framework that is inspired by the mechanisms that are used in database engines, which use a declarative framework to explore multiple equivalent execution plans, all of which produce the correct final result. Similarly, BLARE decomposes a regex into multiple regex and string components and then creates evaluation strategies in which the components can be evaluated in an order that is not strictly a left-to-right translation of the input regex query. Rather than using a cost-based optimization approach, BLARE uses an adaptive runtime strategy based on a multi-armed bandit approach to find an efficient execution plan. BLARE is also modular and can be built on top of any existing regex library. We implemented BLARE on four commonly used regex libraries, RE2, PCRE2, Boost Regex, and ICU Regex, and evaluated it using two production workloads and one open-source workload. BLARE was 1.6× to 3.7× faster than RE2 and 3.4× to 7.9× faster than Boost Regex. PCRE2 did not finish on one of the workloads, but on the remaining two workloads, BLARE improved the performance of PCRE2 by 3.1× to over 100×. For the open-source dataset, BLARE provided a speed up of 61.7× for ICU Regex. BLARE code is publicly available at https://github.com/mush-zhang/Blare.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 4443db96-8a02-4792-aca8-3add732b45d8Cited by top-tier papers3
- Analyzing Near-Network Hardware Acceleration with Co-Processing on DPUsDimitrios Giouroukis, Dwi P. A. Nugroho, Varun Pandey, Steffen Zeuch et al.VLDB 2025 · 3 citations
- An Evaluation of N-Gram Selection Strategies for Regular Expression Indexing in Contemporary Text Analysis TasksLing Zhang, Shaleen Deep, Jignesh M. Patel, Karthikeyan SankaralingamVLDB 2025 · 2 citations
- Regular Expression Indexing for Log AnalysisLing Zhang, Shaleen Deep, Jignesh M. Patel, Karthikeyan SankaralingamSIGMOD 2026
Builds on3
- Achieving 100Gbps Intrusion Prevention on a Single ServerZhipeng Zhao, Hugo Sadok, Nirav Atre, James C. Hoe et al.OSDI 2020 · 38 citations
- Finding data compatibility bugs with JSON subschema checkingAndrew Habib, Avraham Shinnar, Martin Hirzel, Michael PradelISSTA 2021 · 16 citations
- : Near-Storage Accelerator for High-Performance Log AnalyticsSeongyoung Kang, Jiyoung An, Jinpyo Kim, Sang-Woo JunMICRO 2021 · 9 citations
Related papers
- REmatch: a novel regex engine for finding all matchesCristian Riveros, Nicolás Van Sint Jan, Domagoj VrgocVLDB 2023 · 10 citations
- Regex Decision Procedures in Extended RE#Ian Erik Varatalu, Margus Veanes, Ekaterina Zhuchko, Juhan P. ErnitsCAV 2025 · 3 citations
- HybridSA: GPU Acceleration of Multi-pattern Regex Matching using Bit ParallelismAlexis Le Glaunec, Lingkun Kong, Konstantinos MamourasOOPSLA 2024 · 6 citations
- SuSe: Summary Selection for Regular Expression Subsequence Aggregation over StreamsSteven Purtzel, Matthias WeidlichSIGMOD 2025 · 1 citation
- ALVEARE: a Domain-Specific Framework for Regular ExpressionsFilippo Carloni, Davide Conficconi, Marco D. SantambrogioDAC 2024 · 4 citations
