Topic: Strip (preg_match) bbcode of entire quotes, and quote on quote
I have this wich ereases a single quote, and it works fine for a singel quote like this:
$text = "[quote]asdf[/quote]
";
$text = preg_replace('#\[quote\]([^\[]*?)\[/quote\]#', '', $text);
$text = preg_replace('#\[quote=([^\[]*?)\](.*?)\[/quote\]#', '', $text);
echo $quote; // gives nothing...(works)
But it does not work for a quote "tree" like this:
$text = [quote][quote]asdf[/quote]
asdf[/quote]
$text = preg_replace('#\[quote\]([^\[]*?)\[/quote\]#', '', $text);
$text = preg_replace('#\[quote=([^\[]*?)\](.*?)\[/quote\]#', '', $text);
echo $quote; // This time it displays "[quote]asdf[/quote]
".