Regular Expressions 101

Community Patterns

Line parser (split at sentence)

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 - 9 years ago