关于PHP中preg_replace()函数替换问题,用的IDE是Zend stuido 12.1 默认编码UTF-8.

2025-04-13 18:25:34
推荐回答(1个)
回答1:

$mode1 = "/(\[b\])(.*)(\[\/b\])/U";
$replacement = "\\2";
$string = "this is [b]PHP4[/b],this is [b]PHP5[/b]";
echo preg_replace($mode1, $replacement, $string);
?>
注意:反向引用的时候是2个://