GREP: Add Periods to End of ParagraphGREP: Add Periods to End of Paragraph
Find What: ((?<!.)(w|[!?)])(?!.)$)|((?<!.)( )$)
Change to: $1.
What: This GREP query finds paragraphs which don’t end in a period. The “Change to” adds a period at the end of the paragraph.
Why: Often, I get text from a Word document with missing periods. It’s rare that these occur MID paragraphs; they are often left off before line breaks.
Or, fragments (like bullet points or cell contents) get turned into full sentances, and periods need to be added.
I wouldn’t recommend running this query as a “change all” on your whole document, but run it one to the next.
Doing this by hand isn’t always all that tedious, but using the “Find / Change” panel, especially for discontinuous paragraphs, is substantially faster.
How:
1. “Negative Look-behind” — “This text only when is is NOT preceded by…”
1A. A period.’
Sometimes you have a whitespace character after a period. So we ignore those.
2. Any word character
2A. - or -
2B. Either ! or ? or )
The paragraph is either going to end with a letter (a “word character”) an exclamation mark, a question mark, or a close parens. So we’re searching for one of those.
3A. “Negative Look-Ahead” — “ONLY if this is NOT followed by…”
3B. A period
We don’t want to find characters followed by a period — those don’t need to be fixed. So we find ones without.
4. Search for this at the END of a paragraph
OR ( | )
5. “Negative Look-behind” — “This text only when is is NOT preceded by…”
5A. A period.
Sometimes we find the end of a paragaph, with a hanging whitespace and no period. So, we want to search for this. It’s easier to look for it as an “or” statement. In addiiton, when we place a period in, we don’t want to keep that extra space. Doing it this way allows us to do that.
6. A space
7. Search for this at the END of a paragraph