一句话:通过八项指标和53万余条正则的多语言测量,发现提取方法影响小但语言间正则特征差异显著,警示实证结论可推广性。
正则表达式实践影响软件可维护性、正确性与安全,但既有实证研究很少检验提取方法,且多只基于一两种语言,结论可推广性存疑。作者定义八项指标,刻画正则表示、字符串语言多样性与最坏匹配复杂度,比较两种提取方法,并在537,806条正则的多语言语料上测量。结果显示,两种提取方法得到大体可比的语料,说明较简单方法仍可产生可靠语料;但跨语言比较发现若干正则特征显著不同。因此未来实证研究不能忽略编程语言因素,可推广性并非自动成立;这些测量也为新一代正则工具与引擎的数据驱动设计提供了依据。
The regular expression (regex) practices of software engineers affect the maintainability, correctness, and security of their software applications. Empirical research has described characteristics like the distribution of regex feature usage, the structural complexity of regexes, and worst-case regex match behaviors. But researchers have not critically examined the methodology they follow to extract regexes, and findings to date are typically generalized from regexes written in only 1-2 programming languages. This is an incomplete foundation. Generalizing existing research depends on validating two hypotheses: (1) Various regex extraction methodologies yield similar results, and (2) Regex characteristics are similar across programming languages. To test these hypotheses, we defined eight regex metrics to capture the dimensions of regex representation, string language diversity, and worst-case match complexity. We report that the two competing regex extraction methodologies yield comparable corpuses, suggesting that simpler regex extraction techniques will still yield sound corpuses. But in comparing regexes across programming languages, we found significant differences in some characteristics by programming language. Our findings have bearing on future empirical methodology, as the programming language should be considered, and generalizability will not be assured. Our measurements on a corpus of 537,806 regexes can guide data-driven designs of a new generation of regex tools and regex engines.
DOI 原文 ·
@inproceedings{paperbot5198,
title = {Testing Regex Generalizability And Its Implications: A Large-Scale Many-Language Measurement Study},
author = {James C Davis and Daniel Moyer and Ayaan M Kazerouni and Dongyoon Lee},
booktitle = {ASE},
year = {2019},
doi = {10.1109/ase.2019.00048}
}