arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.26139cs.PL
收藏

JavaScript正则表达式匹配的计算复杂性

On the computational complexity of JavaScript regex matching

EPFL, Switzerland(洛桑联邦理工学院);CNRS, ENS de Lyon, Inria, Université Claude Bernard Lyon 1, LIP, France(法国国家科学研究中心、里昂高等师范学院、Inria、里昂第一大学、LIP)

Victor Deng, Aurèle Barrière, Clément Pit-Claudel

AI总结:

本文研究JavaScript正则表达式匹配的计算复杂性,证明其PSPACE-hard,并在无负向lookarounds时为OptP-hard,无下界量化符时为PSPACE完全,无下界量化符和lookarounds时为OptP完全。

摘要:

尽管广泛使用,现代正则表达式匹配的复杂性类尚未明确。先前工作证明了带有回溯和查找的正则表达式匹配为PSPACE完全,但证明未被机械化且应用于抽象正则表达式语言。本文针对JavaScript正则表达式澄清此问题。本文证明了以下新结果,大部分核心证明在Rocq证明助手中机械化。我们证明JavaScript正则表达式匹配确实为PSPACE难,即使没有负向lookarounds,且为OptP难;JavaScript正则表达式匹配在没有下界量化符(即具有非零最小重复数的量化符)时为PSPACE完全;且在没有下界量化符和lookarounds时为OptP完全。

英文摘要:

Despite widespread use, the complexity of the matching problem for modern regular expressions languages remains unclear. Previous work proved that an idealized regular expression language with backreferences and lookarounds had PSPACE-complete matching. We extend this work to a real-world regex language by proving that JavaScript regex matching with expanded lower-bounded quantifiers is PSPACE-complete. We then generalize the result: we show that PSPACE-hardness survives the removal of negative lookarounds, and that removing all lookarounds leads to an OptP-complete parsing problem. Our core arguments are formalized in Rocq.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑