【发布时间】:2011-12-31 22:10:18
【问题描述】:
给定以下句子:
The is 10. way of doing this. And this is 43. street.
我希望 preg_split() 给出这个:
Array (
[0] => "This is 10. way of doing this"
[1] => "And this is 43. street"
)
我正在使用:
preg_split("/[^\d+]\./i", $sentence)
但这给了我:
Array (
[0] => "This is 10. way of doing thi"
[1] => "And this is 43. stree"
)
如您所见,每个句子的最后一个字符都被删除了。我知道为什么会发生这种情况,但我不知道如何防止它发生。有任何想法吗?前瞻和后瞻可以在这里提供帮助吗?我对这些不是很熟悉。
【问题讨论】:
标签: php regex preg-split