InDesign GREP Essentials: What GREP Is and What It Does

Part 1 in a series of posts on using GREP in InDesign for beginners

GREP is scary sounding, especially if you’re not someone who like working with code. While the prospect of learning GREP may be very intimidating to a beginner, the payoff is amazing. It can save you many hours of tedious work, and allow you to accomplish things in InDesign that would otherwise be impossible. The hours you invest in learning GREP will be paid back many times over.

In a nutshell, GREP (“Global Regular Expression Print”) finds patterns of text in InDesign and lets you manipulate that text automatically. Even that is a bit nebulous, so here’s an example I think we can all get behind.

Let’s say you wanted to standardize the way phone numbers were displayed in your document, the problem being the text was input by several people, who all used their own different phone number formatting. You could write a GREP string that takes into account all the possibilities and magically transforms the numbers to your liking. That’s more advanced than I’ll cover here, but we will work a bit with phone numbers along the way.
whatgrepdoes
That’s what GREP is, so where do you find it in InDesign? It lives in two places—the Find/Change dialog box and within paragraph styles—each with their own pros and cons.

indesign-grep-paragraph-style-dialog-box

More after the jump! Continue reading below
Free and Premium members see fewer ads! Sign up and log-in today.

indesign-grep-find-change

The main difference is that when you use Find/Change, you obviously have to re-run the search every time you add or change the text. You also can take full advantage of that dialog box and change the found text (the text that fits the pattern) and style it, change it completely, add to it, delete some of it, and even re-arrange it!

However, when you build a GREP expression into a paragraph style, you can only apply character-level formatting to the found text. There’s no moving around or otherwise manipulating the text. Create a nested GREP style under the GREP Style pane in the Paragraph Style Options dialog box, by entering a GREP expression and indicating which character style to apply.

One thing I always recommend for working with GREP is to keep the search area very specific. I generally search by selected story or even just a small text selection. That way I don’t accidentally format a 10-digit part number like a 10-digit phone number.

Check back for more posts on InDesign GREP tips for beginners. Next up: Using Wildcards

 

Erica Gamet has been involved in the graphics industry for nearly 30 years. She is a speaker, writer, and trainer, focusing on Adobe InDesign and Illustrator, Apple Keynote and iBooks Author, and other print- and production-related topics. She has spoken at the InDesign Conference, PePcon, ebookcraft in Canada, and Making Design in Norway. When she isn’t at her computer, she can be found exploring her new hometown of Seattle and the greater Pacific Northwest.
>