--- { "title": "regexp_replace", "language": "en" } --- # 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 ``` 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 c | +----------------------------------------+ ``` ##keyword REGEXP_REPLACE,REGEXP,REPLACE