next | previous | forward | backward | up | top | index | toc | Macaulay2 web site

replace(String,String,String) -- regular expression replacement of substrings

Synopsis

Description

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).

See also