Abstract
Form validators based on regular expressions are often used on digital forms to prevent users from inserting data in the wrong format. However, writing these validators can pose a challenge to some users. We present Forest, a regular expression synthesizer for digital form validations. Forest produces a regular expression that matches the desired pattern for the input values and a set of conditions over capturing groups that ensure the validity of integer values in the input. Our synthesis procedure is based on enumerative search and uses a Satisfiability Modulo Theories (SMT) solver to explore and prune the search space. We propose a novel representation for regular expressions synthesis, multi-tree, which induces patterns in the examples and uses them to split the problem through a divide-and-conquer approach. We also present a new SMT encoding to synthesize capture conditions for a given regular expression. To increase confidence in the synthesized regular expression, we implement user interaction based on distinguishing inputs. We evaluated Forest on real-world form-validation instances using regular expressions. Experimental results show that Forest successfully returns the desired regular expression in 70% of the instances and outperforms Regel, a state-of-the-art regular expression synthesizer.
Cite
CITATION STYLE
Ferreira, M., Terra-Neves, M., Ventura, M., Lynce, I., & Martins, R. (2021). Forest: An Interactive Multi-tree Synthesizer for Regular Expressions. In Lecture Notes in Computer Science (Vol. 12651 LNCS, pp. 152–169). Springer Science and Business Media Deutschland GmbH. https://doi.org/10.1007/978-3-030-72016-2_9
Register to see more suggestions
Mendeley helps you to discover research relevant for your work.