paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Regexes are Hard: Decision-Making, Difficulties, and Risks in Programming Regular Expressions

正则表达式很难:编程正则表达式中的决策、困难与风险
ASE 2019 34th IEEE/ACM International Conference on Automated Software Engineering (ASE)2019匹配度 2/10 · 该论文是正则表达式开发者行为的实证研究,关注可读性、验证、维护与安全风险认知,属于软件工程/HCI 方向,与用户核心关注的静态分析、LLM/Agent、浮点程序分析或贝叶斯程序分析无明显交叉。引用 61 inbox
Louis G. Michael, James Donohue, James C. Davis, Dongyoon Lee, Francisco Servant
crossref: 2026-09-12

AI 速览

一句话:首个针对正则表达式开发周期的混合方法研究,揭示开发者在决策、验证、维护及安全风险认知上的普遍困难。

正则表达式广泛存在于现代语言与项目中,但既有研究多关注可读性。本文首次系统研究正则开发周期,聚焦开发者如何做决策、面临哪些困难、对严重风险是否了解。作者采用混合方法:问卷调研279名来自不同背景的专业开发者,并访谈17名开发者获取细节。结果显示正则不仅难读,还难搜索、难验证、难文档化;多数参与者未意识到关键安全风险,知情者也缺乏有效应对。研究提出语义化正则搜索引擎、改进输入生成器等未来方向。

问题
现有研究多聚焦正则可读性,缺乏对开发者如何编写、验证和维护正则及其风险认知的整体理解。
方法
采用混合方法,问卷调研279名专业开发者,并深度访谈17名开发者,分析其决策过程、困难与风险意识。
评估
通过问卷统计和访谈主题分析,揭示正则在搜索、验证、文档化及安全风险方面的普遍困难,并提出工具启示。
原文摘要(Abstract)

Regular expressions (regexes) are a powerful mechanism for solving string-matching problems. They are supported by all modern programming languages, and have been estimated to appear in more than a third of Python and JavaScript projects. Yet existing studies have focused mostly on one aspect of regex programming: readability. We know little about how developers perceive and program regexes, nor the difficulties that they face. In this paper, we provide the first study of the regex development cycle, with a focus on (1) how developers make decisions throughout the process, (2) what difficulties they face, and (3) how aware they are about serious risks involved in programming regexes. We took a mixed-methods approach, surveying 279 professional developers from a diversity of backgrounds (including top tech firms) for a high-level perspective, and interviewing 17 developers to learn the details about the difficulties that they face and the solutions that they prefer. In brief, regexes are hard. Not only are they hard to read, our participants said that they are hard to search for, hard to validate, and hard to document. They are also hard to master: the majority of our studied developers were unaware of critical security risks that can occur when using regexes, and those who knew of the risks did not deal with them in effective manners. Our findings provide multiple implications for future work, including semantic regex search engines for regex reuse and improved input generators for regex validation.

链接与引用

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

BibTeX
@inproceedings{paperbot5275,
  title = {Regexes are Hard: Decision-Making, Difficulties, and Risks in Programming Regular Expressions},
  author = {Louis G. Michael and James Donohue and James C. Davis and Dongyoon Lee and Francisco Servant},
  booktitle = {ASE},
  year = {2019},
  doi = {10.1109/ase.2019.00047}
}