Quote:
Originally Posted by fris
why not just create a new custom bb code, or are you trying to replace all the current ones via the database?
|
Yes this is to replace the current ones in the database.
Quote:
Originally Posted by V_RocKs
I believe it is a problem that has more to do with where you are putting the code. I added a small piece to the code to remove the other shit at the end:
Here is the code from my example.. You can drop it into a php extension file and run it on your sever to see the output and play with it yourself...
Code:
<?
$text = '[ame="https://youtube.com/watch?v=wYJ20INbM7Q"]YouTube - ‪Bill O\'Reilly Interviews Rapper Lupe Fiasco - 06/20/11‬‏[/ame]';
$text3 = preg_replace('|\[ame="https://youtube.com/watch\?v=([a-z0-9]+)"\](.+)|i', '[video=youtube;$1]https://youtube.com/watch?v=$1[/video]', $text);
echo "$text <br><br>$text3";
$text5 = '[video=youtube;wYJ20INbM7Q]https://youtube.com/watch?v=wYJ20INbM7Q[/video]';
echo "<br><br>$text5";
?>
And the output is:
[ame="https://youtube.com/watch?v=wYJ20INbM7Q"]YouTube - Bill O'Reilly Interviews Rapper Lupe Fiasco - 06/20/11[/ame]
[video=youtube;wYJ20INbM7Q]https://youtube.com/watch?v=wYJ20INbM7Q[/video]
[video=youtube;wYJ20INbM7Q]https://youtube.com/watch?v=wYJ20INbM7Q[/video]
Which is:
line 1 - original string
line 2 - modified string
line 3 - what you wanted.
Notice 2 and 3 match.
|
Thanks. I have a test database that I am running the test configurations on before I mess with the live forum. 2.5Million posts... so I cant screw it up.
