1
$string = "Some words here. More words, followed by 1.5 and 2.3 here.Here is no space after the dot."

我需要在句子之间的点之后添加空格(如果没有的话),但不要更改浮点数中的点。

$result = "Some words here. More words, followed by 1.5 and 2.3 here. Here is no space after the dot."

曾经是“这里。这里”变成了“这里。这里”

尝试了很多,但找不到解决方案。

4

1 回答 1

3

这个应该做...

preg_replace('/([a-z]+)\.([^\s])/i', '$1. $2', $string);
于 2012-08-06T23:31:32.590 回答