If "%20" are the actual characters in the varchar column you shuld be able
to do 
UPDATE table 
SET    column_name =REPLACE(column_name,'%20',' ');

You might have to use REPLACE(column_name,'\%20',' '); 
to force MySQL to treat "%" as an actual value instead of a wild card.

-----Original Message-----
From: Pooly [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 20, 2006 5:11 AM
To: MySQL General
Subject: Re: Easy regex replace?

2006/3/19, Adam i Agnieszka GÄ…siorowski FNORD <[EMAIL PROTECTED]>:
>
> On 2006-03-18, at 00:59, Yani Copas wrote:
>
> >
> > Is there a quick and dirty way to update such that I can only
> > affect the portion
> > of a string (varchar column) that matches a regexp?
> > (e.g. replace all '%20' with ' ' leaving the rest untouched?)
>
>         You know that proverb - "For a man in possession of a hammer,
> everything looks like a nail".
>   Don't do that. MySQL is *really slow* with Regular Expressions. It
> will be much easier to SELECT
>   all records you want to change, storing their IDs in a list (or
> array) construct, then tell your favourite
>   script program to construct an REPLACE query out of these chosen
> few, after it does whatever you want it to do
>   with the records' data.


Yeah, but sometimes beoing able to do such things on the mysql 
command line would be very helpful ! (Instead of having a script for
such simple things which would be like having a jack hammer for a
nail.. )

--
Pooly
Webzine Rock : http://www.w-fenec.org/


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to