I’m trying to fix a bug in someone’s news system, it uses UBB to allow the editors some sort of flexiblity. So for example to allow bold text the following regex is used:
$message = preg_replace('_\[b\](.*?)\[/b\]_ise', "bold('\\1')", $message);
This works fine. However, there is also a function to strip the UBB code for displaying on the front page, which is as follows:
$message = preg_replace('_\[b\](.*?)\[/b\]_ise', "\\1", $message);
And this regex produces an error, which does not make any sense to me, after all it is the exact same regex.
Fatal error: preg_replace() [<a href='function.preg-replace'>function.preg-replace</a>]: Failed evaluating code: This is bold in /public_html/functions.inc.php on line 122
121 $message = preg_replace('_\[i\](.*?)\[/i\]_ise', "\\1", $message);
122 $message = preg_replace('_\[b\](.*?)\[/b\]_ise', "\\1", $message);
123 $message = preg_replace('_\[u\](.*?)\[/u\]_ise', "\\1", $message);
Try to use:
and