I want to use preg_replace_callback to replace all instances of a custom tag with markup. For instance, I’m using this code to replace instances of “[tube]…[/tube]”:
preg_replace_callback('/\[tube\](.*)\[\/tube\]/', array('MyClass', 'mycallback'), $data);
The problem is it will not match this:
[tube]
http://www.somesite.com
[/tube]
How can I do this?
Note: Yes I am already familiar with the PECL bbcode extension, as well as the PEAR library. But I want to do this without them.
You will have to use pattern modifiers.
http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php