Это старый вопрос, но я все равно выложу свое решение для ppl =]
$open = '<blockquote><span class="bold">Quote: </span><br />'; //the next few lines do the parsing for quote blocks. We
$close = '</blockquote>'; //have to do it outside the normal parsing arrays because that way does not allow nesting.
preg_match_all ('/\[quote\]/i', $str, $matches);
$opentags = count($matches['0']);
preg_match_all ('/\[\/quote\]/i', $str, $matches);
$closetags = count($matches['0']);
$unclosed = $opentags - $closetags;
for ($i = 0; $i < $unclosed; $i++) {
$str .= '</blockquote>';
}
//Do Quotes (nested)
$str = str_replace ('[quote]', $open, $str);
$str = preg_replace('/\[quote\=(.*?)\]/is','<blockquote class="darkbg"><span class="bold left">Quote: $1</span><br />', $str);
$str = str_replace ('[/quote]', $close, $str);
return $str;
Peace.