updating with regexp

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


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-10-2007
lskatz
 
Posts: n/a
Default updating with regexp

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!

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:04 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0