cut off bbcodes with phpmyadmin search and replace

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:

3a7cHPy04s8[/youtube]

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.
 
Using phpMyAdmin, go to a message with a YouTube tag, do a screen print and post the image here for us to see.
 
Once you install the Post Content Find and Replace add-on, you will want to do this:

pic001.webp

Code:
#\[url\](\w+)\[\/youtube\]#siU

[MEDIA=youtube]\1[/MEDIA]
 
I've never used it, but MySQL implements a way to use regular expressions:
http://dev.mysql.com/doc/refman/5.1/en/regexp.html

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.
 
Back
Top Bottom