#857 (ok 4.3) Regexp replace

Next_release
fixed
1
2014-12-05
2006-01-06
No

MYSQL itself does not allow updates using regular expressions.

(I.e. find fields using regular expressions, and update the value in the
field based on captured strings in the regexp.)

I believe this would be an EXTREMELY useful feature for database
maintenance, and should be relatively straightforward to implement in
PHP on top of MYSQL's exisiting REGEXP search feature - which
unfortunately cannot do REGEXP replacments.

Discussion

  • Ruben Barkow

    Ruben Barkow - 2009-07-05

    this sounds interesting and useful

     
  • quibusus

    quibusus - 2011-03-02

    I will implement this feature.

     
  • PHPcian

    PHPcian - 2012-12-25

    Was this feature request worked on?

     
  • Ayush Chaudhary

    Ayush Chaudhary - 2013-02-04

    Is this implemented or in progress? If not, should I give it a try?

     
  • Marc Delisle

    Marc Delisle - 2013-02-04

    It's not implemented nor in progress, but one should first look into recent MySQL versions to see whether it had been implemented in the language.

    Then I guess that this feature would be a part of a general search & replace mechanism, which is not yet part of phpMyAdmin.

     
  • Ayush Chaudhary

    Ayush Chaudhary - 2013-02-04

    On looking around, the best solution at the moment is a MySQL UDF Package (https://launchpad.net/mysql-udf-regexp)

    If we were to implement it, we would use the MySQL's regex search and use php's preg_replace on each of the rows returned. Is that correct?

     
  • Marc Delisle

    Marc Delisle - 2013-02-05

    If I'm not mistaken, UDFs require an installation at the MySQL server level, which would not be possible for many phpMyAdmin users.

     
  • Ayush Chaudhary

    Ayush Chaudhary - 2013-02-05

    Yes, you're right.

    If we want to implement it in phpMyAdmin, should we follow the method I mentioned above? and should I give it a try?

    I am a new contributor looking to get along with the codebase and make some useful contributions.

     
  • Ayush Chaudhary

    Ayush Chaudhary - 2013-02-05

    Yes your suggestion makes sense, but how can we have the user review replaced data for large tables? Or should we just give them partial replace data as a preview?

    And would you recommend using a temporary table for this?

    Another approach could be to give users an option of creating a backup of the current table and if they are happy with the replacements, they could easily drop the backup?

     
  • Marc Delisle

    Marc Delisle - 2013-02-05

    I was thinking about showing a preview for approval. The implementation is up to you. For now I'm busy with version 4.0 issues and this new feature would not be in 4.0 which is frozen.

     
  • Ayush Chaudhary

    Ayush Chaudhary - 2013-02-05

    Okay, I get it. Where or what category should I look at for features/bugs that require immediate working on or are higher in priority?

     
  • Ayush Chaudhary

    Ayush Chaudhary - 2013-02-05

    Thanks a lot. I'll go through them :)

     
  • Nisarg Jhaveri

    Nisarg Jhaveri - 2014-08-03

    Looks like no one is working on it, and it is still not supported. If this is the case, I would like to work on it.

    I'll be following what Ayush suggested, Search with native mysql regexp and then replace rows with PHP's preg_replace. Any suggestions?

     
  • Isaac Bennetch

    Isaac Bennetch - 2014-08-03

    Hi Nisarg Jhaveri, no, it doesn't look like anyone is working on this right now, so go right ahead! As Marc said earlier, it would be best to show a demonstration or proposal before committing a lot of work in order to make sure you're on the same page as the development team. You may wish to discuss some details on the phpmyadmin-devel mailing list.

     
    Last edit: Isaac Bennetch 2014-08-03
  • Marc Delisle

    Marc Delisle - 2014-08-16
    • summary: Regexp replace --> (ok 4.3) Regexp replace
    • status: open --> resolved
    • assigned_to: Marc Delisle
    • Group: --> Next_release
    • Priority: 5 --> 1
     
  • Marc Delisle

    Marc Delisle - 2014-12-05
    • Status: resolved --> fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks