Added in: 2.1
Description
Replaces all occurrences of a substring in a string.
Syntax
REPLACE (str, find, repl)
Examples
replace ('Billy Wilder', 'il', 'oog') -- returns 'Boogly Woogder' replace ('Billy Wilder', 'il', '') -- returns 'Bly Wder' replace ('Billy Wilder', null, 'oog') -- returns NULL replace ('Billy Wilder', 'il', null) -- returns NULL replace ('Billy Wilder', 'xyz', null) -- returns NULL (!) replace ('Billy Wilder', 'xyz', 'abc') -- returns 'Billy Wilder' replace ('Billy Wilder', '', 'abc') -- returns 'Billy Wilder'
Warning: When used on a BLOB, this function may need to load the entire object into memory. This may affect performance if huge BLOBs are involved.