GREP class inserter/look-up

Many of the GREP classes available in InDesign can be inserted using the GREP tab's flyout menu. You open the menu by clicking the @ icon, highlighted in the following screenshot:

[image: grep inserter interface]

The GREP-specific items are in the last six entries of the menu (Wildcards through to Posix). The problem with InDesign's menu is that it's not complete. It never has been: when GREP was introduced (in CS3), quite a few GREP classes that can be used in InDesign were not in the menu, and additions to InDesign's GREP classes in CS4 and CS6 have never been added to the menu.

The script described on this page remedies all that. It creates a panel that contains all GREP wildcards, classes, and other features that can be used be used in InDesign. When you run the script, the following window is opened:

[image: grep inserter interface]

On the left-hand side of the window you see the categories that the script knows. Click a triangle to expand a category and, if necessary, a subcategory. The following screenshot shows the window after we clicked Unicode properties, then Lowercase letter:

[image: grep inserter interface]

The code appears in the field in the lower right of the window. This is a normal text field and you can copy the contents to the clipboard. Some items have a short explanatory text, which is shown in the larger pane, and as shown in the screenshots.

Some codes have a long and a short form. To show long forms, tick the Verbose checkbox. The result is shown in the field with the code: you see that \p{Li} is replaced with \p{Lowercase_letter} (not all items have long and short forms):

[image: grep inserter interface]

To insert the code into the Find what field, click Insert item. But note that the script has no idea where the cursor is in the Find what field, so all it can do is append the code to the end of what is already in the field. If you want to insert a code somewhere in an existing GREP expression in the Find what field, copy the code in the GREP classes panel and paste it anywhere in the Find what field.

[image: grep inserter interface]

Looking up GREP codes

To look up the meaning of an item in a GREP expression that you don't know, enter the item in the script's interface and click Look up. For example, if you come across the tag ~4 and you want to know what it stands for, type ~4 in the script's text field and click Look up. The script then tells you that that tag stands for the quarter-space character:

[image: grep code dictionary]

Looking up InDesign's blue codes

When you show InDesign's hidden characters (Type > Show Hidden Characters), you'll see various special characters and codes, all shown in blue. To show the what these characters stand for and which code can be used in the Find What field to search these characters and codes, highlight the blue character and click Look up. In the screenshot, below, we highlighted the [image: fixed space hidden character] character and clicked Look up. The panel shows that this is the non-breaking space character, and that you can search it using ~S.

[image: grep code dictionary]


Useful script?

Consider making a donation. To make a donation, please press the button below. This is Paypal's payment system; you don't need a Paypal account to use it: you can use several types/brands of credit and debit card.

Peter Kahrel's paypal account

Version history

30 June 2019: The script needed an update to synchronise it with the GREP editor. For stand-alone use this is not relevant.

11 Mar. 2016: Added the look-up function for the blue hidden codes described in the text.

11 Dec. 2015: Added the look-up function described in the text.

28 Feb. 2015: Posted.


Show script (right click, Save Link/Target As to download)

Back to GREP page

Back to main script page

Installing and running scripts

Questions, comments? Get in touch