InDesign GREP Essentials: Ready-to-use Expressions

This article is part of in a series of posts on using GREP in InDesign for beginners.

Learning GREP isn’t easy. Fortunately, InDesign comes with a few ready-to-use expressions already written for you. The two I use the most are especially handy for cleaning up Word files riddled extraneous white space (extra spaces after punctuation and extra returns).

Multiple Return to Single Return

In the Find/Change dialog box, go to the Query pull-down menu. The middle section contains GREP searches. The “Multiple Return to Single Return” query looks for two or more consecutive returns and replaces that pattern with a single return. The expression is written as ~b~b+. The first ~b (for break character) finds the hard return that denotes the end of a paragraph: we need that one. The second ~b means there is at least a second hard return and that one has to go. If we knew there were always only the two, we could stop there. Problem is, people that throw in one extra return have no regard for common decency, so you can’t know that they didn’t throw in another return. Or five. The plus sign in the expression, remember, indicates one or more times, which covers an infinite number of returns. It then changes the found text to a single return.

The built-in expression to find at least two of any kind of space

The built-in expression to find at least two of any kind of space

Multiple Space to Single Space

The “Multiple Space to Single Space” query is truly a thing of beauty. As the name suggests, you can clean up all those pesky extra spaces that people still insist on putting in after punctuation. If you’re looking for [space][space] and replacing it with [space], get ready for a huge upgrade. The [space][space] way does no good when the person who made the file put in three spaces in a row, or thought it would be clever to use two en spaces and a thin space, for some unknown reason. The ready-to-use expression, on the other hand, uses a character class (the text within square brackets) to say, “Find any one of these characters.” It doesn’t care what order they’re in or if there’s a combination of them. The {2,} you should recall indicates 2 or more times (see: InDesign GREP Essentials: Quantity). The query then returns everything that fits that pattern with a single, simple word space, .

Bookmark
Please login to bookmark Close

This article was last modified on July 25, 2019

Comments (6)

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading comments...