X Course Advisor FREE Course Advisor
(Close)
Watch Tutorials
macProVideo.com
Close
InDesign: Understanding GREP Styles

Check out our InDesign: Working With Text course!

I’ll be blunt: GREP is a tool for Nerds. And GREP Styles are a tool for Nerds Who Really Like InDesign. Still, it’s a remarkably useful tool, and it could prove to be quite handy, as it lets you search for a complex (or simple) series of characters, and apply a Character Style to just those characters automatically. Let that sink in a little, then read on.

So what’s GREP?

The Global Regular Expression Parser lets you find nearly anything you want, using either a complex series of codes, or (thankfully) a series of drop-down menus. It’s not just for a specific word, though; you can search for wildcards, for some item repeated one or more times, for a phrase you want to re-style.

Here’s a super-fancy GREP preset from the more traditional Find/Change dialog.

Here’s a super-fancy GREP preset from the more traditional Find/Change dialog.

Even better, you can separate parts of the search terms and replace them in a different order. It’s an obscure form of magic from the land of Unix. You could, for example, search for:

  • two spaces in a row
  • the name of your company 
  • four digits followed by an apostrophe followed by an s
  • the first letter at the start of a paragraph
  • 15 or more characters between quote marks

And what do GREP Styles do again?

They let you apply a Character Style to something you found. So, without changing any of the source text—potentially important if it’s still linked to a changing document—you could:

  • squish those two spaces into the space of one
  • embolden and capitalize the name of your company
  • italicize a decade
  • capitalize the first letter of every paragraph
  • apply a grey, italic style to quotations

Great! How do I do it?

First, create a Character Style which makes the results obvious. In the Character Style panel, press the New button, then double-click the new Character Style 1 to edit it. Set the name to “noticeable”, the font style to Bold and Character Color to red. Now we’ll easily see when our GREP styles will be applied.

The Character Style should look like this once set up.

The Character Style should look like this once set up.

Next, create a Paragraph Style which will apply the GREP styles. In the Paragraph Style dialog, press the New button, then double-click the new Paragraph Style 1 to edit it. Set the name to “GREPped”, and make sure Preview is enabled.

Normally, you would add GREP styles to the Paragraph Styles you wanted them to work in, but this is a good way to experiment. Press OK, then apply the GREPped style to a chunk of text in your document.

Apply that Paragraph Style!

Apply that Paragraph Style!

Set up the GREP

Double-click GREPped in the Paragraph Style panel to edit it, then choose GREP Style from the left side. Press the New GREP Style button. Under the Apply Style drop-down, choose “noticeable”, the Character Style dialog you made earlier. Right now, it’s applying to “\d+”, meaning “a digit, repeated one or more times”. As soon as you click away from the GREP Style you’re currently editing, any numbers in your text will turn bold red.

A selection of GREP styles all applied as part of a single Paragraph Style.

A selection of GREP styles all applied as part of a single Paragraph Style.

What about the other recipes above?

They’re easy enough to build using the drop-down menu on the right-hand side of the “To Text” field. These two are easy, just type them:

  • two spaces in a row
  • the name of your company 

These are a little harder:

  • four digits followed by an apostrophe followed by an s: \d\d\d\d’s
  • the first letter at the start of a paragraph: ^[\l\u]
  • at least 15 characters between quote marks: “...............+”

And here are the results of the style applied to some fake text.

And here are the results of the style applied to some fake text.

Conclusion

There’s much more to it, and of course Google is your friend if you want to know more about GREP. We might even write more about it in another article here. There are also some handy built-in GREP expressions in the Find/Replace dialog which you can repurpose into handy GREP styles. For now, know that GREP Styles can save a heap of work in the right circumstances. They’re great, they’re geeky, and that’s OK.

Check out our InDesign: Working With Text course!

Iain Anderson

Iain Anderson | Articles by this author

Iain Anderson is an editor, animator, designer, developer and Apple Certified Trainer based in Brisbane, Australia. He has taught privately and in tertiary institutions, and has freelanced for Microsoft and the Queensland Government. Comfortable with anything from Quartz Composer to Second Life and Final Cut Pro to Adobe Creative Suite, he has laid out books, booklets, brochures and business cards; retouched magazine covers and product packaging, shot and edited short films and animated for HD broadcast TV, film festivals and for the web.

Comments

You must be logged in to post a comment.
Create an Account  Login Now

What is macProVideo.com?

macProVideo.com is an online education community featuring Tutorial-Videos & Training for popular Audio & Video Applications including Adobe CS, Logic Studio, Final Cut Studio, and more.
© 2018 macProVideo.com
a division of NonLinear Educating Inc.
Link