From: Eric Bergen Date: January 22 2011 5:18pm Subject: Re: Is is possible to update a column based on a REGEXP on another column? List-Archive: http://lists.mysql.com/mysql/224194 Message-Id: MIME-Version: 1.0 (iPad Mail 8C148) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable There isn't a built in way but you can try http://www.mysqludf.org/lib_mysql= udf_preg/ I would go with the php/perl script if this is a one time thing. -Eric On Jan 21, 2011, at 11:31 AM, Phil wrote: > I have a table which contains a username column which may be constructed > something like >=20 > somename[AAAAA] or [BBBBCCCCDDD]someothername >=20 > The AAAAA or BBBBCCCCDDD can be anything at all. >=20 > I've added a new column to the table to which I'd like to populate with th= e > value within the square brackets. >=20 > I could write something in perl or php to run through each and update them= > but was wondering if there is a way to do this within mysql itself? The > regexp only returns a boolean so I can't see how to use that. >=20 > Regards >=20 > Phil >=20 >=20 > --=20 > Distributed Computing stats > http://stats.free-dc.org