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

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

 

Tags
Posted on: December 27, 2016

Erica Gamet

Erica Gamet has been involved in the graphics industry for over 25 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 is a regular contributor to InDesign Magazine, tech edited How To Do Everything with Adobe InDesign CS4, and served as leader of the Denver InDesign User Group. After living as a nomad for almost a year, she recently put down roots in El Paso, Texas, where she hikes and bikes every chance she gets. Check out ericagamet.com to see all of Erica's upcoming events, tips and tricks, and workbooks.

Leave a comment

Your email address will not be published.


*