Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
([^\.!?…\n]*[\.!?…])?((?:[^\.!?…]*[\.!?…])*?)([^\.!?…\n]*)\n
/

Description

Splits a line into three parts: completed sentences from the previous line, any complete sentences, and any uncompleted sentences.

Submitted by E.Gu - 10 years ago