Replace

### Program Information

Name: Replace
Domain: Algorithm
Functionality: Regular expression matching and substitutions.
Input:  A regular expression $r$, a replacement string $s$, an input file as input parameters. The regular expressions in the source and follow-up test cases are denoted as $r_s$ and $r_f$, respectively.
Output: An output file resulting from replacing any substring in the input file that matched by $r$, with $s$.

#### Reference

 Metamorphic slice: An application in spectrum-based fault localization https://doi.org/10.1016/j.infsof.2012.08.008

### MR Information

#### MR1------Extension and permutation in brackets

Description:
Property: $[x_1-x_n] \Rightarrow [x_1\cdots x_n],[x_1\cdots x_n] \Rightarrow [x_{i_1}\cdots x_{i_n}]$ where $[x_1-x_n]$ in $r_s$ is repaced by its extended equivalent $[x_1\cdots x_n]$ and $\langle x_{i_1},\cdots ,x_{i_n} \rangle$ is a permutation of $\langle x_1,\cdots ,x_n \rangle$
Source input: $[x_1-x_n]$
Source output: $Replace([x_1-x_n])$
Follow-up input: $[x_1\cdots x_n],[x_{i_1}\cdots x_{i_n}]$
Follow-up output: $Replace([x_1\cdots x_n]),Replace([x_{i_1}\cdots x_{i_n}])$
Input relation: $[x_1-x_n]$ in $r_s$ is repaced by its extended equivalent $[x_1\cdots x_n]$ and $\langle x_{i_1},\cdots ,x_{i_n} \rangle$ is a permutation of $\langle x_1,\cdots ,x_n \rangle$
Output relation: $[x_1-x_n] \Rightarrow [x_1\cdots x_n],[x_1\cdots x_n \Rightarrow [x_{i_1}\cdots x_{i_n}]$
Pattern:

#### MR2------Bracketing simple characters

Description:
Property: $(x) \Rightarrow ([x])$ where simple character $(x)$ is equivalent to itself enclosed by the brackets $([x])$
Source input: $(abc)$
Source output: $Replace(abc)$
Follow-up input: $([a][b][c])$
Follow-up output: $Replace([a][b][c])$
Input relation: simple character $(abc)$ is equivalent to itself enclosed by the brackets $([a][b][c])$
Output relation: $[abc]=([a][b][c])$
Pattern:
Insert title here