Thanks for coming to InDesignSecrets.com, the world's #1 resource for all things InDesign!

Tip of the Week: Making White Space Characters Easier to Work With in GREP

This InDesign tip on making white space characters easier to work with in GREP was sent to Tip of the Week email subscribers on December 28, 2017.

InDesignSecrets Tip of the Week

Sign up now and every week you’ll get a new tip, keyboard shortcut, and roundups of new articles, plus exclusive deals sent right to your Inbox!

Just scroll down to the bottom of this page, enter your email address, and click Go! We’ll take care of the rest. Now, on with the tip!


By Peter Kahrel

Space characters are often not so easy to spot in GREP expressions. To make them visible in your code, use \x{0020}, which is the Unicode notation for the space character. Or use the code \s, which stands for any white space (including paragraph breaks and tabs). For example, set[-\s]?up has the same meaning as set[- ]?up but is much clearer since someone looking at the code doesn’t have to guess if there’s a space there, or what is meant by the invisible space after the dash.

Peter Kahrel

Peter Kahrel

Peter Kahrel is a script developer at Typefi Systems. He is the author of several eBooks on InDesign and scripting, including GREP in InDesign, published by O’Reilly Media. He also wrote the feature article on "Getting a Grip on GREP" in InDesign Magazine Issue 59.
Peter Kahrel

Latest posts by Peter Kahrel (see all)

  • - November 30, -0001
Tags
Related Articles
Comments

One Comment on “Tip of the Week: Making White Space Characters Easier to Work With in GREP

  1. Similar to \s is \h which grabs any horizontal space. Just then thing when you want to leave the returns alone.

Leave a Reply

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