If a backslash followed by a digit occurs in
r, then in the result they are replaced by the string matching the corresponding parenthesized subexpression of
p.
i1 : replace ("[a-z]+", "x", "Dog cat cat.")
o1 = Dx x x.
|
i2 : replace ("([a-z]+)", "(\\1)", "Dog cat cat.")
o2 = D(og) (cat) (cat).
|