I know this regex divides a text into sentences. Can someone help me understand how?
/(?<!\..)([\?\!\.])\s(?!.\.)/
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Portions:
([\?\!\.])\s: split by ending character (.,!,or?) which is followed by a whitespace character (space, tab, newline)(?<!\..)where the characters before this ‘ending character’ arent a.+anything(?!.\.)after the whitespace character any character directly followed by any.isn’t allowed.Those look-ahead (
(?!) & look-behind ((?<!) assertions mainly seem to prevent splitting on (whitespaced?) abbreviations (q. e. d.etc.).