如何用
'... '
后接以大写字母开头的文本来分割句子?
显示错误:
Lopende tekst...\nVolgende zin.
它应该导致:
Lopende tekst...
Volgende zin.
代码:
<?php
$txt="Lopende tekst... Volgende zin.";
$txt=preg_replace('/(\.{3})( )([A-Z])/','\\1\n\\3',$txt);
echo($txt);
?>
单引号
''
没有像转换后的 \n
那样的特殊字符,如果需要,请使用双引号 ""
。喜欢:
<?php
$txt="Lopende tekst... Volgende zin.";
$txt=preg_replace('/(\.{3})( )([A-Z])/',"\\1\n\\3",$txt);
echo($txt);
?>