depending on your requirements, you might want to consider a few more things. - there are other sentence-ending punctuations than a period. - there are other contexts for using a period than a sentence-ending punctuation such as within a dollar amount, a url, etc.
Very good points. I actually had to code some fixes in to repair situations like those you mentioned. Particularly around dollar amounts and Urls. But it is definitely helping more than hurting from a formatting perspective. You would not believe how many folks type sentences without putting a space after each period. ;-)
Here's a Thanksgiving gift. You seem to be working hard on this problem.
s/(?<=[A-Za-z])(\.)\s*(?=[A-Z](?:[a-z]¦ ))/. /g;
This one shouldn't mess up prices or URL's (unless the URL's are mixed-case, which I don't see much of these days). It will ensure exactly one space following qualifying periods, so it will handle too many or too few.
?<= is a lookbehind assertion ?= is a lookahead assertion [A-Za-z]is a character class