One of the most powerful (and least intuitive) features added in Adobe InDesign CS3 is the new GREP panel in the Find/Change dialog box. GREP is a powerful tool that lets you use wildcards to search and replace text.
A full discussion of GREP in InDesign is beyond what we can cover in one of our tips. Instead, this tip includes links to a number of resources, cheatsheets, and a great book published by O’Reilly on using GREP in InDesign CS3.
GREP in InDesign CS3 — The Book.
The best resource we’ve found for learning to use GREP in InDesign, is GREP in InDesign CS3 by Peter Kahrel.
This 47-page book costs $9.99 and is available as a downloadable PDF directly from O’Reilly Media.
Link: GREP in InDesign CS3
To me, the most useful parts in the book are the examples Kahrel uses to illustrate different techniques. Seeing these examples in use helps underscore what is possible with GREP.
Some examples covered in the book:
- Swap First and Last Names
- Change First Names to Initials
- Remove Duplicate Entries in a List
- Replace Certain Hyphens with an En Dash
- Keep Certain Words Together
- Avoid Single-Word Last Lines
Personally, I’d like to see a follow-up GREP book that collects dozens of example GREP recipes people could modify for their own purposes.
GREP Tips from InDesign Secrets.
The InDesign Secrets blog has a GREP resource page for people who want to learn more about using GREP in InDesign. Here are some recent posts that hint at the type of flexible solutions you can craft using GREP:
- GREP: Find Text Between Parentheses, Quotes, Etc.
- GREP: Removing the Paragraph Return at the End of Story.
- GREP: Using GREP to Make a Character Lowercase
- GREP: Solution to Flawed Title Case Feature.
- GREP: Find Text, Change to Graphic (Great Example)
GREP Character Cheatsheet.
InDesign trainer Mike Witherell has put together a handy one-page cheat sheet of all of the text and GREP metacharacters you can use in InDesign’s Find/Change dialog box.
Link: GREP versus Text Metacharacters PDF
Source: This tip inspired in part by the introduction of GREP styles in InDesign CS4. Check out Steve Laskevitch’s InDesign CS4 video preview.