This is a discussion on updating with regexp within the MySQL Database forums, part of the Database Forums category; Hi, Is there a way to perform an update using regexp AND with capturing parentheses? For instance, I have a ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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! |