REGEXP_REPLACE
This function replaces the occurrences of pattern
in a string
by replace_string
.
Syntax
regexp_replace::=
Usage Notes
- For details and examples for regular expressions, refer to Regular Expressions section.
- If pattern is
NULL
,string
is returned. - If
replace_string
is omitted orNULL
, the matches ofpattern
are deleted in the result. - In
replace_string
you can use captures by \1, \2, ..., \9 or \g<name> which are defined bypattern
. - The optional parameter
position
defines from which position the search shall begin (starting with 1). - The optional positive number
occurrence
defines which occurrence shall be searched for. - For additional information, see functions REPLACE, REGEXP_INSTR, and REGEXP_SUBSTR, and the predicate [NOT] REGEXP_LIKE.
The
occurrences do not overlap. Therefore, search of the second occurrence begins at the first character after the first
occurrence. In case of 0 all occurrences are replaced (default). In case of a positive integer n
, the n-th occurrence
will be replaced.