A practical guide to mastering Find/Change patterns. No programming experience required.
GREP stands for Global Regular Expression Print. In InDesign, it's a powerful way to find and replace text patterns β not just specific words, but types of text.
Think of it this way:
Real-world example: Instead of manually fixing 500 instances of double spaces, one GREP pattern finds ALL of them in seconds.
Ctrl+F (Windows) or Cmd+F (Mac)Let's start simple. The most common text problem: double spaces.
Wait β that's just normal Find/Change! You're right. But what if there are THREE spaces? Or four? Let's use GREP:
π Congratulations! You just wrote your first GREP pattern. The {2,} means "2 or more" β that's a quantifier.
GREP uses special characters to represent types of text:
| Pattern | Meaning | Matches |
|---|---|---|
. |
Any single character | a, B, 3, @, space |
\d |
Any digit | 0, 1, 2, 3... 9 |
\w |
Any word character | a-z, A-Z, 0-9, _ |
\s |
Any whitespace | space, tab, line break |
\t |
Tab character | β |
\r |
Paragraph break | ΒΆ |
\n |
Forced line break | β΅ |
β οΈ Important: Some characters have special meaning in GREP: . * + ? ^ $ [ ] ( ) { } | \
To find these literally, add a backslash: \. \* \?
Quantifiers specify how many times a pattern should repeat:
| Quantifier | Meaning | Example |
|---|---|---|
* |
Zero or more | ab*c β ac, abc, abbc, abbbc... |
+ |
One or more | ab+c β abc, abbc, abbbc... (not ac) |
? |
Zero or one | colou?r β color, colour |
{3} |
Exactly 3 | \d{3} β 123, 456, 789 |
{2,4} |
Between 2 and 4 | \d{2,4} β 12, 123, 1234 |
{2,} |
2 or more | \s{2,} β multiple spaces |
Anchors match positions, not characters:
| Anchor | Meaning | Example |
|---|---|---|
^ |
Start of paragraph | ^The β "The" at paragraph start |
$ |
End of paragraph | \.$ β period at paragraph end |
\b |
Word boundary | \bcat\b β "cat" not "category" |
Parentheses ( ) create groups that you can reuse in the replacement:
| In Find | In Change | Meaning |
|---|---|---|
(pattern) |
$1 |
First captured group |
(first)(second) |
$1 $2 |
First and second groups |
π‘ Pro Tip: $0 contains the entire match. Useful when you want to wrap text: Find \d+, Change ($0) puts all numbers in parentheses.
Real patterns you can use today:
| Mistake | Problem | Solution |
|---|---|---|
| Forgetting to escape | . matches ANY character, not just period |
Use \. for literal period |
| Greedy matching | ".*" matches from first to LAST quote |
Use ".*?" for shortest match |
| Case sensitivity | the won't find "The" |
Use [Tt]he or enable case-insensitive |
| Testing on live document | Can't undo "Change All" properly | Always test on a copy first! |
Golden Rule: Always click "Find Next" a few times before "Change All" to make sure your pattern matches what you expect!
Want to understand GREP better? Here are some excellent resources:
| Resource | Description |
|---|---|
| Treasures of GREP | Facebook group where InDesign professionals share, learn, and improve GREP workflows together |
| GREP in InDesign | The definitive book by Peter Kahrel |
| InDesignSecrets | Great community with GREP tips and tricks |
| CreativePro | Articles and tutorials from industry experts |
| Regex101 | Online regex tester (GREP is based on regular expressions) |
Now that you know the basics:
Browse hundreds of ready-to-use patterns and see GREP in action.