Ian Mackinnon
Ian Mackinnon

Reputation: 14238

Can MySQL do regular expression substitution in an UPDATE?

I've seen MySQL SELECT examples using the REGEXP operator for matching.

Is there a way to do regular expression substitution in an UPDATE?

If not, what's the simplest method to run a regex substitution on all values in a column?

Feel free to suggest using any programming language or regex implementation.

Upvotes: 3

Views: 514

Answers (1)

Wrikken
Wrikken

Reputation: 70460

Basically, no. You can use some cumbersome REPLACE() calls, create UPDATE statements in a script which does support regex replaces, or use some UDF, this one for instance

Upvotes: 2

Related Questions