Log in

View Full Version : Using replacement variables to adapt old BBcode?


thefnool
01-07-2010, 01:44 PM
On my forum, until recently I was using YouTube bbcode with the following formatting:

XXXXXX

Where XXXXXX is the variable at the end of a youtube URL.

My new formatting is:

http://www.youtube.com/watch?v=XXXXXX

However, with the change I am left with lots of posts containing unparsed embedded videos using the old code. I'm trying to work out a way to use replacement variables to alter every instance of the old formatting to the new formatting.

The way I see it, I need to globally replace with
[youtube]http://www.youtube.com/watch?v=
As this would mean that the closing tag would be left intact, and all old videos would then parse correctly.

What would the formatting be for a replacement variable that would replace all instances of [youtube=Anything goes here] with [youtube]http://www.youtube.com/watch?v= ?

If this is impossible, are there any plugins/products that would facilitate such a change? Or, is it possible to do a similarly specifically-targeted find/replace in my database?

Digital Jedi
01-09-2010, 11:57 PM
<a href="https://vborg.vbsupport.ru/showthread.php?t=202476" target="_blank">AME 2.5</a> has some tools that will let your rebuild old BBCode and convert them to AME tags. In this case, your users don't even have to use a button to embed the video, or even know how to. A link to a YouTube page will auto embed when posted, and the conversion tool should make all the old embeds remain. It's lighter than BBCode and you can add additional sites pretty easily if you want them. I think it might be easier than what your trying to do, and make it even easier on your users.