An Empirical Study on Regular Expression Bugs
An Empirical Study on Regular Expression Bugs
复制标题
DOI:
10.1145/3379597.3387464
复制
发表时间:
2020-05
期刊:
影响因子:
--
通讯作者:
Peipei Wang;Chris Brown;Jamie A. Jennings;Kathryn T. Stolee
中科院分区:
文献类型:
--
作者:
Peipei Wang;Chris Brown;Jamie A. Jennings;Kathryn T. Stolee
Understanding the nature of regular expression (regex) issues is important to tackle practical issues developers face in regular expression usage. Knowledge about the nature and frequency of various types of regular expression issues, such as those related to performance, API misuse, and code smells, can guide testing, inform documentation writers, and motivate refactoring efforts. However, beyond ReDoS (Regular expression Denial of Service), little is known about to what extent regular expression issues affect software development and how these issues are addressed in practice. This paper presents a comprehensive empirical study of 350 merged regex-related pull requests from Apache, Mozilla, Facebook, and Google GitHub repositories. Through classifying the root causes and manifestations of those bugs, we show that incorrect regular expression behavior is the dominant root cause of regular expression bugs (165/356, 46.3%). The remaining root causes are incorrect API usage (9.3%) and other code issues that require regular expression changes in the fix (29.5%). By studying the code changes of regex-related pull requests, we observe that fixing regular expression bugs is nontrivial as it takes more time and more lines of code to fix them compared to the general pull requests. The results of this study contribute to a broader understanding of the practical problems faced by developers when using regular expressions.