paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Static Analysis for Checking the Disambiguation Robustness of Regular Expressions

检查正则表达式消歧鲁棒性的静态分析
PLDI 8(PLDI)2024匹配度 3/10 · 论文属于传统程序分析与形式语言方向,研究正则表达式消歧鲁棒性,包含复杂性证明和实用静态分析实现,方法论上与静态分析兴趣有弱相关;但未涉及 LLM/Agent、ML 系统、浮点程序分析或贝叶斯程序分析,与用户当前核心方向交叉很弱。引用 6 inbox
Konstantinos Mamouras, Alexis Le Glaunec, Wu Angela Li, Agnishom Chattopadhyay
crossref: 2026-09-10

AI 速览

一句话:提出正则表达式消歧鲁棒性概念,证明判定问题为 PSPACE 完全,并给出实用静态分析算法与优化。

正则表达式常用于序列数据的匹配与提取,但其固有歧义使匹配结果依赖消歧策略,主流有 POSIX 最长左匹配与贪婪(PCRE)策略,跨引擎复用正则时可能产生不同输出。论文提出“消歧鲁棒性”:若正则的提取语义在 POSIX 与贪婪策略下相同,则该正则鲁棒。作者将该性质判定问题形式化,证明其为 PSPACE 完全,并设计静态分析算法检查非鲁棒性,附带两项性能优化。实现后在大规模、多领域正则数据集上实验,表明方法实用。

问题
正则表达式匹配提取的消歧策略选择会影响输出,跨引擎复用可能不一致;核心问题是判定正则是否对 POSIX 与贪婪策略不敏感。
方法
形式化消歧鲁棒性判定问题,证明其 PSPACE 完全,并提出静态分析算法及两项性能优化。
评估
实现所提算法,并在来自多个应用领域的大规模正则表达式数据集上进行实验,验证其实际可用性。
原文摘要(Abstract)

Regular expressions are commonly used for finding and extracting matches from sequence data. Due to the inherent ambiguity of regular expressions, a disambiguation policy must be considered for the match extraction problem, in order to uniquely determine the desired match out of the possibly many matches. The most common disambiguation policies are the POSIX policy and the greedy (PCRE) policy. The POSIX policy chooses the longest match out of the leftmost ones. The greedy policy chooses a leftmost match and further disambiguates using a greedy interpretation of Kleene iteration to match as many times as possible. The choice of disambiguation policy can affect the output of match extraction, which can be an issue for reusing regular expressions across regex engines. In this paper, we introduce and study the notion of disambiguation robustness for regular expressions. A regular expression is robust if its extraction semantics is indifferent to whether the POSIX or greedy disambiguation policy is chosen. This gives rise to a decision problem for regular expressions, which we prove to be PSPACE-complete. We propose a static analysis algorithm for checking the (non-)robustness of regular expressions and two performance optimizations. We have implemented the proposed algorithms and we have shown experimentally that they are practical for analyzing large datasets of regular expressions derived from various application domains.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot2506,
  title = {Static Analysis for Checking the Disambiguation Robustness of Regular Expressions},
  author = {Konstantinos Mamouras and Alexis Le Glaunec and Wu Angela Li and Agnishom Chattopadhyay},
  journal = {Proceedings of the ACM on Programming Languages},
  volume = {8},
  number = {PLDI},
  year = {2024},
  doi = {10.1145/3656461}
}