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.
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.
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:
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:
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.
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!
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.
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:
These are a little harder:
And here are the results of the style applied to some fake text.
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.