How to stop [code] tag from parsing other BBCode?
I am trying to make a bbcode {code] tag tha doesn't parsing inside
[code]...[/code]. Here is my code:
function bbdisable($bbtext)
{
$search = array('[', ']');
$replace = array('[', ']');
return str_replace($search, $replace, $bbtext);
}
$BBCodeText = preg_replace('#\[code\](.*?)\[\/code\]#seU', '"<div
class=\"code\"><div class=\"code_title\">Code:</div><div
class=\"code_text\"><code>".$this->bbdisable("$1")."</code></div></div>"',
$BBCodeText);
It works, but when I have:
[code][code]text[/code][/code]
[code][code]text[/code][/code]
it fushions the tags and the resault is this:
[code]text[/code][/code]
[code][code]text[/code]
In other words, doing parser the first [code] with the very last [/code],
regardless if they are two different lines. Any ideas how to fix it?
Thank you!