Accessibility
Adobe
Sign in My orders My Adobe

Applying GREP styles

Michael Ninness

Michael Ninness

 

Learn InDesign CS4

Learn InDesign CS4

Created:
15 Oct 2008
User Level:
Intermediate, Advanced
Products:
InDesign CS4 or later

Learn how to apply a character style to any text that matches the GREP expression you specify. Make the GREP style part of a paragraph style.

AlertThis content requires Flash

Download the free Flash Player now!

Get Adobe Flash Player


Requirements

To complete the tasks demonstrated in this tutorial, you need the following software and files:

Adobe InDesign CS4

Sample file

lrvid4028_id.zip (ZIP, 52MB)

Prerequisite knowledge

Basic knowledge of GREP code and character styles

Applying GREP styles

Adobe® InDesign® CS4 has added a number of automation features that allow you to format a range of text quickly and efficiently. In this tutorial, you will learn about GREP styles, one of the new automated features in InDesign.

An introduction to GREP

GREP, or Global Regular Expression Print, is a text-search utility that allows you to find complex words or phrases using special characters, variables, and arguments. InDesign incorporates GREP expressions in the Find/Change dialog box. To find text using GREP:

  1. Choose Edit > Find/Change. The Find/Change dialog box opens.

    find change dialog box

    Figure 1: The Find/Change dialog box
  2. Choose the GREP tab. Click the @ symbol next to the Find What box in the Find/Change dialog box.

    Find What menu

    Figure 2: The Find What context menu
  3. Choose Wildcards > Any Digits. The GREP code for Any Digits appears in the Find What box.
  4. Click the @ icon again and choose Repeat > One Or More Times. Additional GREP code appears in the Find What box. You have just typed in GREP code for “find one or more digits in a row.”
  5. Test the code by clicking Find in the Find/Change dialog box. You will see that the program locates the first number in the document. Click Find Next to find the next number in the document. Repeat this process as needed to locate all the numbers in the document.

Using GREP styles

You can also use change the style of text throughout your document using a combination of paragraph styles and GREP expressions, called GREP styles. To use GREP styles:

  1. Close the Find/Change dialog box.
  2. Make sure the Advanced workspace is selected in the toolbar at the top of the InDesign window.

    advanced workspace

    Figure 3: The Advanced workspace
  3. Click the Paragraph Style icon.

    New Paragraph Style icon

    Figure 4: The New Paragraph Style icon
  4. Choose New Paragraph Style from the pop-up menu that appears. The New Paragraph Style dialog box opens.

    New Paragraph Style dialog box

    Figure 5: The New Paragraph Style dialog box
  5. Choose GREP Style from the pane on the left side of the New Paragraph Style dialog box.
  6. Click the New GREP Style button. By default, InDesign starts with the last-used search term (in this case, the GREP code for “one or more digits in a row”) that you entered in the Find/Change dialog box in the previous section.
  7. To apply a character style to everything tagged by the GREP code, click the Apply Style menu. Select a character style from the menu. Click OK. The document is immediately updated to include the change. Moreover, the new character style is applied to anything you type in the future that matches the GREP expression.

    new character style

    Figure 6: Applying a new character style
  8. To add a second GREP style, repeat steps 4-5. You can change the text the style is applied to by entering a new word, phrase, or GREP expression in the To Text box.

    Tip: You can apply GREP styles to telephone numbers, URLs, and e-mail addresses using this same basic process.

Where to go from here

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License

About the authors

Michael Ninness paid his way through the Graphic Design program at the University of Washington by teaching digital imaging tools and techniques to professional designers and photographers. Since 1994, he has worked professionally in the graphics software industry as a product manager and user interface designer of products for creative professionals at Extensis, Microsoft and Adobe.