Express Yourself – Using Regular Expressions in Graphic Design

Posted on Posted in Indesign, Tips and Tricks

Not so long ago I was working as an in house graphic designer at a local Pennsylvania based jewelry retailer. During my time there I worked with some very talented people who despite the constraints put on them in such a setting, still managed to produce some amazing work. My duties there involved product photography, poster design, social media marketing and some light web development. This is where I was lucky to be paired with my friend J.D. Isaacks who at that time served as their senior web developer and before my arrival also managed all of the print design for the company.

JD taught me many things while I was there that at the time I never would thought might transfer to the world of graphic design, but even until this day, I still use some of the techniques I learned while we worked together. One of those nuggets I use regularly in my indesign workflow involves GREP styling. When JD taught me about this I only knew them as regular expressions and he used them in his programming. Little did I know that I could use those same selectors in the world of print. Let me take you through one of my projects to show you how I use regular expressions with GREP styling to help my project come together.

Sample text for Indesign layout

For this company newsletter a variety of people are writing the stories appearing in my layout. Sadly none of these people are using InDesign to write their stories. In fact most are using standard word processing software that came loaded on their PCs so I’ll have to copy and paste their content into my layouts before I can use it. Here is a sample story in google docs that I’ll be formatting with GREP.

the pasted text has extra returns

 

When I copy and paste this story into my layout the first thing I notice are extra returns at the end of each paragraph. To keep my formatting consistent all of those extra returns have to go. It wouldn’t be too difficult to go through and just select each one and delete them one at a time. But what if this was a story with multiple pages and there were a lot of these extra spaces. By using the find and replace function we can remove all of these at once.

 

make sure to select GREP when using the Find/Change box

 

First I’ll make sure to select the tab marked GREP. What I’m looking for is any standard return followed by a second standard return. What I mean by that are those points in the article where the author double spaced after a paragraph to show separation. Using the dropdown to select that break character, I set the search dropdown to selection and select Change All.

 

you can select these spaces from the flyout menu

 

the double returns have been removed

Just like that, all of those extra returns are gone.

 

using the regular expression for white spaces lets you fix all of those double spaces

 

Now let’s double check that there aren’t extra spaces in this as well. I’ll use those old regular expressions from back in the day to search again for double spaces and sure enough there were a few spots where they showed up.

 

Extra spacing after the sentences is fixed with regular expressions.

 

Now this might not seem like a big deal to some people, but if you’re tight on space in a layout and the client absolutely HAS to have all of this information, it’s a nice trick to have up your sleeve while not altering the look of your font.

The extra returns have been fixed

 

Here is the complete layout all fixed up. I hope I was able to help some of you with your layouts and for those of you interested in learning more about programming be sure to visit JD’s website that I linked to earlier in this post. I’ll be back next time with more from the world of graphic design. Until then, feel free to drop me a line here on the blog or get in touch on twitter where I can be found at @JulianBaughman. Thanks!
Julian