Interactive TEsting And Repairing of Regular EXpressions

TearRex

Writing a regular expression that exactly captures a set of desired strings is difficult, since regular expressions provide a compact syntax that makes it difficult to easily understand their meaning. Testing is widely used to validate regular expressions. Indeed, although a developer could have problems in writing the correct regular expression, (s)he can easily assess whether a string should be accepted or not. Starting from this observation, we propose an iterative mutation-based process that is able to test and repair a faulty regular expression. The approach consists in generating strings S that distinguish a regular expression rgx from its mutants, asking the user to assess the correct evaluation of S, and possibly substituting rgx with a mutant rgx' that evaluates S more correctly than rgx.

TearRex program

To run TearRex, download the jar file and execute it in this way
	java -jar TearRex.jar 
	
TearRex will ask first the regex candidate and then it will start to ask the user to evaluate some strings. An example of execution is:

TearRex syntax

The syntax accepted by TearRex can be found here http://www.brics.dk/automaton/doc/dk/brics/automaton/RegExp.html
TearRex supports also
\d is short for [0-9]
\w stands for "word character"
\s stands for "whitespace character"

Some benchmarks can be downloaded here and some more here
TearRex is based on MutRex whose code is on github
Mutation operators used in TearRex and the theory behind MutRex can be found in:
Paolo Arcaini, Angelo Gargantini, Elvinia Riccobene Faultā€based test generation for regular expressions by mutation in Software Testing, Verification and Reliability, March 2018 download the pdf