Bug #27389 regular expression substitute
Submitted: 23 Mar 2007 6:24 Modified: 29 Apr 2007 12:16
Reporter: Hans Ginzel Email Updates:
Status: Verified Impact on me:
Category:MySQL Server Severity:S4 (Feature request)
Version:5.0 OS:Any (any)
Assigned to: CPU Architecture:Any
Tags: regular expression, substitute

[23 Mar 2007 6:24] Hans Ginzel
Add function for regular expression substitutes:
SUBSTITUTE(str, regexp, replace_str_with_possible_backreferences_to_searched_subpatterns).
Be inspired by Perl's s///.

How to repeat:
replace(str, regular_expression, replace_str) does handle regular_expressions as search string not as regexp.
[29 Apr 2007 12:16] Valeriy Kravchuk
Thank you for a reasonable feature request.
[7 Mar 2014 17:18] Tomas Telensky
Some workaround, though not ideal, might be found here http://stackoverflow.com/q/986826/684229
[20 Jan 2015 14:47] Björn Holmgren
doesn't seems to happens anything 8 years after ... ?
[15 Jul 2015 11:54] Sami Lehtimki
Would this be simple to fix in MySQL itself, as hholzgra has already made UDF to address this issue? https://github.com/hholzgra/mysql-udf-regexp (havent yet personnaly tested this UDF, but need is very clear).
[16 Dec 2016 13:24] Aaron Gibian
This issue affects me and I hope this functionality might be implemented into MySQL. I have subscribed to updates.

Oracle has this functionality: https://docs.oracle.com/cd/B28359_01/server.111/b28286/functions138.htm#SQLRF06303
[31 May 2019 22:13] Christopher Boudreau
We are unable to upgrade to MySQL 8. 

It would be nice to have this feature in MySQL 5!