【发布时间】:2013-03-17 10:37:33
【问题描述】:
我正在使用以下正则表达式将字符串拆分为数组。一切都很好,但由于某种原因它没有与\.(space) 分开。我需要如何对其进行更改才能使其正常工作?
$sentences = preg_split(" / (\. |, and|, or|, but|, nor|, so|, for|, yet|after|although|as|as if|as long as|because|before|even if|even though|if|once|provided|since|so that|that|though|till|unless|until|what|when|whenever|wherever|whether|while) /",$sentences);
【问题讨论】:
-
真的要匹配(空格)(点)(空格)吗?
-
@ÁlvaroG.Vicario 我想匹配(点)(空格)
-
@bicycle no
/ (\. |,总是需要一个前缀空格\s.\s。/(\. |,会修复它
标签: php regex preg-split