InDesign GREP snippets

InDesign uses a Perl flavor of regex.1 The following are some useful expressions I have accumulated over the years.

Find page references

\b(([Pp]age)|(p+\.))\s\d+

Remove extra white space

This looks for contiguous white space characters and removes all but the last instance.

Find:

(\s+)(\s)

Replace:

$2

Footnotes:

1

As far as I know this is not documented by Adobe directly. See this question on the graphic design Stack Exchange.

Author: Roger Farrell

Created: 2025-09-18 Thu 14:13

Validate