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!
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!