![]() |
Help with cleaner.php (REGEX)
I need to replace an outdated mods text in posts.
Old code example: Code:
[ame="http://www.youtube.com/watch?v=wYJ20INbM7Q"]YouTube - ‪Bill O'Reilly Interviews Rapper Lupe Fiasco - 06/20/11‬‏[/ame] Code:
[video=youtube;wYJ20INbM7Q]http://www.youtube.com/watch?v=wYJ20INbM7Q[/video] Code:
$text = preg_replace('|\[ame="http://www.youtube.com/watch\?v=([a-z0-9]+)"\](.+)|i', '[video=youtube;$1]http://www.youtube.com/watch?v=$1[/video]', $text); I put it here: PHP Code:
Please tell me how to execute this code. Thanks |
What is cleaner.php? Where did you get it from?
|
Quote:
|
Quote:
You find this in cleaner.php PHP Code:
PHP Code:
Try that. Make sure you have a backup though, I couldn't test this. |
Got some progress. :up:
(I am running this on a test database to get the syntax right) Cleaner ran but I got the error: Warning: preg_replace(): Compilation failed: unmatched parentheses at offset 48 I looked at the test thread and it deleted the string I want to replace but it did not replace it ( due to the error ) So if I can get the code correct it should work. --------------- Added [DATE]1309380139[/DATE] at [TIME]1309380139[/TIME] --------------- Success! Here is the regex pattern that worked: Code:
$text = preg_replace('|\[ame="http://www.youtube.com/watch\?v=([a-z0-9]+)"\](.+)|i', '[video=youtube;$1]http://www.youtube.com/watch?v=$1[/video]', $text); |
I took another look at the code, I think there were a couple typos-
try this line: Code:
$text = preg_replace('#\[ame="http://www.youtube.com/watch\?v=([a-z0-9]+)"\](.+)#siU', '[video=youtube;$1]http://www.youtube.com/watch?v=$1[/video]', $text); |
All times are GMT. The time now is 03:19 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|