我正在尝试做一个 preg_replace 来转换来 bbcode。基本上,这
[QUOTE=ksiva]blahblah blah[/QUOTE]
需要看起来像这样
<div class=quote-msg"><div class="quote-author"><em>ksiva</em></div>blahblah blah</div>
我尝试了这个 preg 替换,但它不起作用。我究竟做错了什么?
$pattern = '#\[QUOTE=([a-zA-Z]*|\#?[0-9a-fA-F]{6})](.*?)\[/QUOTE\]#s';
$replace = '<div class="quote-msg"><div class="quote-author><em>$1</em></div>$2</div>';
$text = PREG_REPLACE($pattern, $replace, $text);