REPLACE()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Replaces all occurrences of one string with another and returns the resulting string.
USAGE
REPLACE(string, find, replace)
Argument Name | Description |
---|---|
| The source string |
| The string to find |
| The replacement string |
DETAILS
REPLACE()
is a string function that returns the original string with all occurrences of the find
string replaced by the replace
string.
The search performs a case-sensitive match.
A NULL
is returned if any argument is NULL
.
EXAMPLES
SELECT REPLACE('mcricdb', 'c', 'a');
+------------------------------+
| REPLACE('mcricdb', 'c', 'a') |
+------------------------------+
| mariadb |
+------------------------------+
SELECT REPLACE('FOO Foo foo is foo', 'foo', 'bar');
+---------------------------------------------+
| REPLACE('FOO Foo foo is foo', 'foo', 'bar') |
+---------------------------------------------+
| FOO Foo bar is bar |
+---------------------------------------------+