Wildcards
Wildcards are one of the main features of GREP. Most of them are listed in the next-to-last panel in the flyout at Wildcards, though there are some additional ones in two other parts of the flyout: Quotation Marks and Posix. In addition, you can create your own wildcards defining character classes. We'll outline all of them in turn.
Any Character
As it says, matches anything. The symbol for this wildcard is .
(a dot; it is equivalent to ^?
in the Text tab of the Change/Find dialog). Enter a dot in the "Find what" field; pressing Find repeatedly finds every next character in the document. The only exception is the return character (or paragraph mark), though that behavior can be changed (see the section entitled "Leftovers"). Example: b..d
finds all four-letter words that start with a b and end with a d.
Any Uppercase Letter
\u
finds any uppercase letter. This covers all Unicode characters that can be considered letters, such as all Latin letters with accents, Cyrillic, Hebrew, and Arabic. I'll run a bit ahead and introduce an operator here that is useful and gives more sense to the wildcards outlined in this section. This operator is +
and means "at least one." Combined with the "Any Uppercase Letter," \u+
means "find at least one uppercase letter." When you try it, you'll see that InDesign finds any sequence of one or more capital letters, so this simple expression is useful for finding acronyms and other abbreviations. But to avoid A and I and any other single-letter words, ...
Get GREP in InDesign CS3 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.