Test, validate and match regular expressions
Matches sentences in text by starting at the first non-whitespace character and lazily consuming any characters (including newlines) until reaching sentence-ending punctuation (., ?, or !). The lazy quantifiers ensure each match stops at the first terminator, and with the global flag it extracts all sentences via match()/matchAll(). Note it may incorrectly split on abbreviations or decimals like 'e.g.' or '3.14'.