Returns a string that results from replacing or dropping byte substrings in the first of its arguments as specified by the patterns of its other arguments.
The format for the $ZREPLACE function is:
$ZREPLACE(expr1[,expr2[,expr3]])
The first expression specifies the byte string on which $ZREPLACE() operates. If the other arguments are omitted, $ZREPLACE() returns this expression.
The optional second expression specifies the byte substring for $ZREPLACE() to replace. If this argument is omitted, $ZREPLACE() returns the first expression without modification.
The optional third byte expression specifies the replacement for the second expression. If this argument is empty or omitted, $ZREPLACE() drops all occurrences of the substring in the second expression.
Example:
GTM>write $zreplace("ABCABCABCABC","AB","xyz") xyzCxyzCxyzCxyzC GTM>
$ZREPLACE() searches for the second expression "AB" in the first expression "ABCABCABCABC". Since "AB" exists in the first expression(four times), it replaces all four occurrences with the third expression "xyz".