Test, validate and match regular expressions
Matches a whitespace character followed by a single word (optionally hyphenated, like 'well-known') that ends with a period, capturing both the full ending and the word itself. It is commonly used in PHP to fix typographic widows — lone words stranded on the last line of a paragraph — by replacing the leading space with a non-breaking space ( ). The hyphenated alternative ensures compound words at sentence ends are handled too.