regexp_replace

description

Syntax

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

Regular matching of STR strings, replacing the part hitting pattern with repl

example

1. mysql> SELECT regexp_replace('a b c', " ", "-");
2. +-----------------------------------+
3. | regexp_replace('a b c', ' ', '-') |
4. +-----------------------------------+
5. | a-b-c                             |
6. +-----------------------------------+

8. mysql> SELECT regexp_replace('a b c','(b)','<\\1>');
9. +----------------------------------------+
10. | regexp_replace('a b c', '(b)', '<\1>') |
11. +----------------------------------------+
12. | a <b> c                                |
13. +----------------------------------------+

keyword

REGEXP_REPLACE,REGEXP,REPLACE