VeloDB Cloud
SQL Manual
Functions
string-functions
regexp
regexp_replace

regexp_replace

Description

Syntax:

VARCHAR regexp_replace(VARCHAR str, VARCHAR pattern, VARCHAR repl)

This function performs regular matching on the string str, and replaces the parts of the string that match the condition specified by pattern with repl.

Example

mysql> SELECT regexp_replace('a b c', " ", "-");
+-----------------------------------+
| regexp_replace('a b c', ' ', '-') |
+-----------------------------------+
| a-b-c                             |
+-----------------------------------+

mysql> SELECT regexp_replace('a b c','(b)','<\\1>');
+----------------------------------------+
| regexp_replace('a b c', '(b)', '<\1>') |
+----------------------------------------+
| a <b> c                                |
+----------------------------------------+

Keywords

REGEXP_REPLACE,REGEXP,REPLACE