next | previous | forward | backward | up | top | index | toc | home
Macaulay2 > The Macaulay2 language > strings and nets > regular expressions > replace > replace(String,String,String)

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

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