Reply To: GREP to find first two words of a sentence

Home Page / Forums / General InDesign Topics (CLOSED) / GREP to find first two words of a sentence / Reply To: GREP to find first two words of a sentence

#83983
Ari Singer
Member

The reason it doesn’t pick up words with an apostrophe is because the ‘any word character’ wildcard (\w) excludes an apostrophe. So the obvious solution is to add an apostrophe in the string before the \w followed by a ? which translates to: Find an apostrophe, which may or may not be there, followed by any word character one or more times. So this is the final string:

(?<=\. )'?\w+? \w

This article was last modified on April 12, 2016

Comments (0)

Loading comments...