Using Square Brackets in Your InDesign GREP Search
When you’re looking for one of many possible characters in GREP, brackets let you make a list.
This article appears in Issue 65 of InDesign Magazine.
Looking for a vowel? GREP lets you find a, e, i, o, or u, by placing brackets around them like this: [aeiou]. In other words, brackets create a list of possible matches, as though saying “any one of these.” One of the most common uses for a bracket list is searching for variations of the same letter. For example, [aA] will find a lowercase or uppercase letter a.
You can find even more variations of a letter by placing it inside brackets and equal symbols. For example, [=a=] will find a, A, â, ä, á, à, Å, and more—those are all considered variations of the letter a.
The bracket expression can also be turned around to find characters not in the list. For example, [^aeiou] means any character except vowels—the caret symbol at the beginning means “not.” I find this particularly helpful when searching for character that is not punctuation.
You can even search for a range of characters. For instance, [A-Fa-f0-9] will find any hexadecimal number (any number between zero and 9, or any upper- or lowercase letter between a and f. I show how to use this technique to find all Japanese characters in text in this post.
As you know, some characters have special meanings in GREP, such as the dot, asterisk, and dollar symbols. However, all but the backslash lose their meaning in a square bracket expression. For example, [ .,*[] means find a space, period, comma, asterisk, open left bracket, or tab.
Of course, if you’re actually searching for a bracket in your text, you’ll have to “escape” it with a backslash. For example, \[a\] finds this text: [a].
![InDesign find/change dialog box shows GREP search term:[-uld._]+@[-uld_]+.[ul]{3}](https://creativepro.com/wp-content/uploads/2025/01/square_brackets-fig01.jpg)
Commenting is easier and faster when you're logged in!
Recommended for you
Update to PDFClerk Pro
SintraWorks is delighted to announce PDFClerk Pro 3.7, an update to their very p...
Importing Word Styles Only
Use this quick workaround to import Word styles into an InDesign document. (Yes,...
Album Moxie: The Savvy Photographer’s Guide to Album Design and more—with InDesign
There’s an old saying that when all you have is a hammer, everything looks...
