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

keyword REGEXP_REPLACE,REGEXP,REPLACE