1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

cut off bbcodes with phpmyadmin search and replace

Discussion in 'General PHP and MySQL Discussions' started by dethfire, Sep 24, 2014.

  1. dethfire

    dethfire Well-Known Member

    I have made a mistake of epic stupidity. It's really amazing.

    Instead of simply making a new custom bbcode for [youtube] I somehow thought it was a good idea to do a search and replace in phpmyadmin to remove the tags. Wow was that stupid. I've ended up with hordes of video posts with simply the following content like this:


    I might win the idiot admin award, I know, I know.

    So what are my options here? I appears I need a regular expression because there is no common identifier on the front and then somehow append the [youtube] bbcode back.
  2. AndyB

    AndyB Well-Known Member

    Why not restore from last nights backup?
  3. dethfire

    dethfire Well-Known Member

    I would lose a lot of data
  4. AndyB

    AndyB Well-Known Member

  5. dethfire

    dethfire Well-Known Member

    That looks very interesting! Now I just need help with the regular expression :)
  6. AndyB

    AndyB Well-Known Member

    Using phpMyAdmin, go to a message with a YouTube tag, do a screen print and post the image here for us to see.
  7. dethfire

    dethfire Well-Known Member

    They are in this format

  8. AndyB

    AndyB Well-Known Member

    Once you install the Post Content Find and Replace add-on, you will want to do this:


    eva2000 likes this.
  9. dethfire

    dethfire Well-Known Member

    ugg, I blew through 2G of PHP memory and it still errors out. I can't up it any more.
  10. Ridemonkey

    Ridemonkey Well-Known Member

    I've never used it, but MySQL implements a way to use regular expressions:

    Would alleviate your problem with PHP memory if you can run it straight against the database.

    Though if you just run the PHP tool over and over and over again it should eventually fix everything (each time it should convert records until it runs out of memory)... but it's going to impact your server performance doing that.
  11. EQnoble

    EQnoble Well-Known Member

Share This Page