GREP of the Month: Horizontal and Vertical Spaces
Erica Gamet offers some easy to remember codes you can use to quickly select any kind of whitespace.

This article appears in Issue 64 of InDesign Magazine.
If you use GREP in InDesign, you either know the name Peter Kahrel or you should. He literally wrote the book on using GREP in InDesign. I had the pleasure of meeting him in person at this year’s PePcon (in my GREP session, so no pressure there). He let me in on a little addition to InDesign’s subset of GREP expressions that goes back to CS6: the wild cards \v and , that represent vertical and horizontal white space, respectively.
The \v wildcard will find both hard and soft returns, so it can be used in place of the [\r] expression. However, the expression has even more promise in that it will find all white space except for the return character \r. That will make looking for two or more spaces even easier.
The built-in GREP expression for “multiple space to single space” looks for [~m~>~f~|~S~s~<~/~.~3~4~%]{2,}, which looks for each specific type of white space when there are two or more together. We’ve always been able to simplify it as {2,}, but unlike the previous expression, that will also find—and change—multiple returns.
Using the command, that expression can be written more simply as {2,} which will find everything from the first expression, as well as multiple tabs in a row, but not the multiple return characters.
For those who use GREP for text cleanup a lot, this could be a huge timesaver. If you’re not using at least the built-in GREP expressions to automate with InDesign, what are you waiting for?
Commenting is easier and faster when you're logged in!
Recommended for you

Illustrator Downloadable: Tropical Shadow Overlay Kit
This downloadable package comes with two Illustrator files containing 14 symbols...

Illustrator Downloadable: Summer Citrus Pattern Set
Downloadables are an exclusive benefit for CreativePro members! (Not a member ye...

InDesign Downloadable: Tables SuperGuide
Downloadables are an exclusive benefit for CreativePro members! (Not a member ye...