Created
October 22, 2015 08:37
-
-
Save saveman71/219ca07c499428b40427 to your computer and use it in GitHub Desktop.
This regex will split a text in sentences respecting punctuation, and thinks like "M. Lastname" will not break the sentence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sentences = text.match(/(M\.|Mme\.|Mlle\.|\.\w|(?:\.\.\.|…)\s+[a-z]|[^\.!\?\n…])+[\.!\?\n…]+/g); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment