Splitting paragraphs into sentences with regexp and PHP

我的梦境 提交于 2019-11-30 05:02:59

Unicode RegExp for splitting sentences: (?<=[.?!;])\s+(?=\p{Lu})

Explained demo here: http://regex101.com/r/iR7cC8

Searching for such a pattern still seems unreliable but as sentences may be ended by line returns I would try just the following

[.\!\?][\s\n\r\t][A-Z] 

I don't think you actually meant for the look-ahead's do you? ( !? together, so using the \ escapes it - tells the regex ignore any special meaning )

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!