Dplreplace

Effect
Replaces the given pattern within the text by replacement.

pattern is a regular expression as defined by php.

replacement may contain references to matching parts.

Example
returns:

returns:

The second example only replaces "a" by "A" if there is an "r" somewhere after the "a".