Basically I am trying to convert xenforo’s forum script database over to my custom one (dropping my use on xenforo) and their bbcode is annoying me.
I am trying to change all the url bbcode from theirs to mine with this:
$message = preg_replace("/\[url\=\'(.+?)\'\](.+?)\[\/url\]/is",
"[url=$1]$2[/url]", $message);
Basically they have single quotes surrounding the urls i don’t want them but my code doesn’t work.
If you use double quotes for your regexp string, you must double escape, because PHP interprets backslashes as well
Test case
and its output
The test is done on Ubuntu 12.04 and with PHP 5.3.10.