REGEXP_REPLACE Usage Notes - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905
REGEXP_REPLACE has a limitation in handling ASCII Chr(0), which is NULL. If you concatenate two strings using ASCII Chr(0), REGEXP_REPLACE cannot handle that input string. For example, consider the following code:
sel TD_SYSFNLIB.RegExp_Replace ('a'||chr(0)||'bc', '[b]', 'X', 1, 0) AS 
regex_rep_input_string;
The function is supposed to replace the b in the input string "'a'||chr(0)||'bc'" with X. The result must be a Xc. However, because of the limitation, the result is a.