Free Blog |  HTTPPoint discussion forum |  Recreation vehicle insurance |  Casino news |  Debt Info |  Debt Info(uk) |  Computer Info |  History of computer |  Flight Simulator | 

PDA

View Full Version : updating with regexp


lskatz
06-17-2008, 03:31
Hi,
Is there a way to perform an update using regexp AND with capturing
parentheses?

For instance, I have a varchar containing gdh_-9 and I want to update
it so that it only contains the digits. In other words, I would like
to capture the 9 in gdh_-9 and update the row with the 9.

I'm thinking that the expression would be something like this
UPDATE table SET name=\1 WHERE name REGEXP '(\d+)'
because the perl behind it would be something like this
$name=~s/(\d+)/\1/g

Thanks for any help!

Free Blog |  HTTPPoint discussion forum |  Recreation vehicle insurance |  Casino news |  Debt Info |  Debt Info(uk) |  Computer Info |  History of computer |  Flight Simulator | 
ESW5080
ESW5080 pricing from pricerunner.

Printers
Get the best printers from Pricerunner.