Contents
replace()
A function for replacing parts of a string with another string
replace()
is a system function for replacing parts of a string with another string.
replace()
was added in PostgreSQL 7.3.
Usage
replace (string
text
,from
text
,to
text
) →text
Change history
- PostgreSQL 7.3
- added (commit 89260124)
Examples
Basic usage example for replace()
:
postgres=# SELECT replace('foobar','bar','baz'); replace --------- foobaz (1 row)
does of course work with multibyte characters:
postgres=# SELECT replace('わくわく','わく','ほげ'); replace ---------- ほげほげ (1 row)
References
- PostgreSQL documentation: Other String Functions