Repairing Regex-Dependent String Functions
Nariyoshi Chida, Tachio Terauchi
摘要
Regex-dependent string functions are string functions that take regular expressions (regexes) as parameters and are popular means of manipulating strings. They are frequently used for, e.g., string transformation and substring search. Despite the importance, writing these functions is far from easy. To rectify this situation, recent research made significant progress by proposing automated methods for synthesizing regexes based on Programming by Examples (PBE). However, there still is a gap between these methods and the goal of synthesizing regex-dependent string functions. First, the existing methods focus on whole-string matching, whereas most regex-dependent string functions adopt substring matching. Second, the existing methods focus only on the regex, but many commonly used regex-dependent string functions, such as replace and replaceAll, also take as parameter a replacement to specify how the substrings matched to the regex will be replaced. This paper fills the gap by presenting the first PBE-based method for repairing regex-dependent string functions. Like the recent methods for regex synthesis, our algorithm builds on enumerative search with pruning and SMT constraint solving, but with extensions to support substring matching and replacement. The main challenge is the large search space. We address the challenge by novel ideas such as incorporation of origin information in examples to identify the locations of substrings to be matched, a new substring-context-aware pruning technique, and a novel use of SMT constraints to insert captures that can be referred from the replacement. Additionally, we identify a novel necessary and sufficient condition that can be used to detect and filter unrepairable instances. We implemented our algorithm as a prototype tool called R2-DS and evaluated it on real-world benchmarks. Results show that our algorithm efficiently repairs the bugs in the real world and finds high-quality repairs. CCS CONCEPTS • Software and its engineering → Software notations and tools; • Theory of computation → Regular languages.
问问这篇 Paper
智能体会读完全文。
Lune 把这篇 Paper 索引到了每一个公式,引用它的顶会 Paper 也一样。你提问,回答直接引用原文。
引用它的顶会 Paper1
问问它们各自怎么用它它引用的顶会 Paper8
- Multi-modal synthesis of regular expressionsQiaochu Chen, Xinyu Wang, Xi Ye, Greg Durrett 等PLDI 2020 · 被引用 81 次
- Interactive Program Synthesis by Augmented ExamplesTianyi Zhang, London Lowmanstone, Xinyu Wang, Elena L. GlassmanUIST 2020 · 被引用 57 次
- Solving string constraints with Regex-dependent functions through transducers with priorities and variablesTaolue Chen, Alejandro Flores-Lamas, Matthew Hague, Zhilei Han 等POPL 2022 · 被引用 39 次
- No Strings Attached: An Empirical Study of String-related Software BugsAryaz Eghbali, Michael PradelASE 2020 · 被引用 17 次
- TRANSREGEX: Multi-modal Regular Expression Synthesis by Generate-and-RepairYeting Li, Shuaimin Li, Zhiwu Xu, Jialun Cao 等ICSE 2021 · 被引用 16 次
相关 Paper
- Repairing Regex-Dependent String-Manipulation ProgramsNariyoshi Chida, Tachio TerauchiCAV 2026
- Repairing Regular Expressions for ExtractionNariyoshi Chida, Tachio TerauchiPLDI 2023 · 被引用 9 次
- Spine: Scaling up Programming-by-Negative-Example for String Filtering and TransformationChaoji Zuo, Sepehr Assadi, Dong DengSIGMOD 2022 · 被引用 4 次
- SynGuar: guaranteeing generalization in programming by exampleBo Wang, Teodora Baluta, Aashish Kolluri, Prateek SaxenaFSE 2021
- FlashRegex: Deducing Anti-ReDoS Regexes from ExamplesYeting Li, Zhiwu Xu, Jialun Cao, Haiming Chen 等ASE 2020 · 被引用 17 次
