Bug #2894 More regexp string functions
Submitted: 19 Feb 2004 9:00 Modified: 7 Oct 2005 18:52
Reporter: Ben Dilley Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Server Severity:S4 (Feature request)
Version: OS:
Assigned to: CPU Architecture:Any

[19 Feb 2004 9:00] Ben Dilley
It strikes me that a lot of the string functions are crippled by their lack of regexp support. For example, I would like to write an update script which will do a regexp find + replace like so:

UPDATE docs 
SET text = RREPLACE(text, 'foo.*?bar', 'bar') 
WHERE text RLIKE 'foo.*?bar'

...but I can't. I appreciate that this probably opens up a can of worms, but it would be really useful!

How to repeat:
Try any regexp find + replace function at SQL level.

Suggested fix:
Add new string functions which mimic the existing ones, but use regex, e.g. RREPLACE(str, from_regex, to_regex)
[14 Mar 2005 18:12] Emanuele Dolis
Oh, yes, 
I was just typing the same - and since I've read that MySQL is going to change the regexp engine,  I think it could be the right time to fill this enormous gap - at least by starting providing a RXP_REPLACE or something like that.

Hope you're thinking of it - it it a critical function for data cleaning.

[7 Oct 2005 18:52] Hartmut Holzgraefe
Duplicate of bug #1926