BBcode报价 - 论坛

时间:2014-06-28 08:29:04

标签: php regex bbcode

你能帮帮我吗?我有两个转换报价代码。所以我想从html到这些[quote=user name]TEXT[/quote]

$replace[] = '/\[quote\=(.*?)\]((?:(?!\[\/?quote\]).)*)\[\/quote\]/is';
$rewrite[] = '<blockquote><div class="msg_quote"><span id="quote_from">$1 je napisal/a</span><span class="citiranje_text">$2</span></div></blockquote>';

$change = preg_replace($replace, $rewrite, $text_message);

1 个答案:

答案 0 :(得分:0)

以下模式可行,

preg_replace("/\[quote=(.*?)](.*?)\[\/quote]/", $r, $sub);