### Program Information

Name: Replace
Domain: Algorithm
Functionality: Performing regular expression matching and substitutions.
Input:
R:The regular expressions(Type: Expression) S: A replacement string(Type: String) I:An input file(File)
Output:
O: An output file resulting from replacing any substring in the input file that matched by R. (Type: File)

#### Reference

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

### MR Information

#### MR1

Source input: $I_s$ ; Source output: $O_s$
Follow-up input: $I_f$ ; Follow-up output: $O_f$
Input relation: $I_f$ = Changing all characters in $I_s$ with lower cases into their upper cases.
Output relation: The size of $O_f$ = The size of $O_s$ All the elements with categories of ‘‘keyword’’ in $O_s$ become ‘‘identifier’’ in $O_f$. Non-keyword elements of $O_s$ , the corresponding categories remain the same in $O_f$.

#### MR2

Source input: $I_s$ ; Source output: $O_s$
Follow-up input: $I_f$ ; Follow-up output: $O_f$
Input relation: $I_f$ = Deleting all comments in $I_s$.
Output relation: $O_f = O_s$

#### MR3

Source input: $I_s$ ; Source output: $O_s$
Follow-up input: $I_f$ ; Follow-up output: $O_f$
Input relation: $I_f$ = Inserting the comment symbol ‘‘;’’ at the very beginning of some arbitrarily chosen lines in $I_s$.
Output relation: $O_f \subseteq O_s$

#### MR4

Source input: $R_s,S_s,I_s$ ; Source output: $R_f,S_f,I_f$
Follow-up input: $O_s$ ; Follow-up output: $O_f$
Input relation: The condensed sub-expression: $R_s = [x_{1}-x_n]$ $R_f = [x_{1} \cdots x_n]$ $S_f = S_s$ $I_f = I_s$ The extended sub-expression: $R_s = [x_{1} \cdots x_n]$ $R_f = [x_{i_{1}} \cdots x_{i_n}]$, where $“< x_{i_{1}} \cdots x_{i_n} >”$ is a permutation of “$< x_{1} \cdots x_n >$”. $S_f = S_s$ $I_f = I_s$
Output relation: $O_f = O_s$

#### MR5

Source input: $R_s,S_s,I_s$ ; Source output: $R_f,S_f,I_f$
Follow-up input: $O_s$ ; Follow-up output: $O_f$
Input relation: $R_s=[x_{1} \cdots x_n]$ or $[x_{1}-x_n]$ $R_f=[x_{1} \cdots x_{i-1} [x_i][x_{i+1}] \cdots [x_{i+m}] x_{i+m+1} \cdots x_n]$ $S_f = S_s$ $I_f = I_s$
Output relation: $O_f = O_s$

#### MR6

Source input: $R_s,S_s,I_s$ ; Source output: $R_f,S_f,I_f$
Follow-up input: $O_s$ ; Follow-up output: $O_f$
Input relation: $R_f$ = Replacing the escaped reserved words with ‘‘@’’ in $R_s$ with the bracketed format. $S_f = S_s$ $I_f = I_s$
Output relation: $O_f = O_s$

### Related

Insert title here