Using GREP Find/Change
Video: Using GREP Find/ChangeIf only all the manuscripts we received to pour into InDesign were structured and formatted perfectly. No random extra spaces or returns, no elements missing or out of order. Well, that's a nice dream, but in most cases it's fairly unlikely. Fortunately, you can fix all those problems with an amazing Find/Change option with a funny name, GREP. One of the things that GREP is great for is text cleanup. Whenever you're confronted with a manuscript that has extra returns or spaces or things like that, you should immediately think about GREP. In fact, you don't even need to figure out how to construct GREP expressions for those common text cleanups, because they're already in InDesign.
Viewers: in countries Watching now:
Creating Long Documents with InDesign shows designers how to create book-length documents in workflows with multiple users—using both InDesign features and third-party plug-ins. Publishing veteran Mike Rankin focuses on long document elements such as page and chapter numbering, table of contents, cross-references, and indexes. The course also provides an overview of document construction, from creating master pages and applying consistent formatting with styles to placing text and images and outputting to both print and interactive PDF.
- Using text variables
- Creating templates for InDesign, InCopy, and Word
- Employing nested styles
- Creating GREP styles
- Managing color with swatches
- Building page elements with libraries and snippets
- Performing GREP find/changes
- Using InCopy workflows
- Tracking changes
- Adding footnotes and indexes
- Using InDesign book files
- Versioning documents with conditional text or object styles
- Preflighting documents
- Archiving a project
- Finding and installing useful scripts and plug-ins for frequent challenges
Using GREP Find/Change
If only all the manuscripts we received to pour into InDesign were structured and formatted perfectly. No random extra spaces or returns, no elements missing or out of order. Well, that's a nice dream, but in most cases it's fairly unlikely. Fortunately, you can fix all those problems with an amazing Find/Change option with a funny name, GREP. One of the things that GREP is great for is text cleanup. Whenever you're confronted with a manuscript that has extra returns or spaces or things like that, you should immediately think about GREP. In fact, you don't even need to figure out how to construct GREP expressions for those common text cleanups, because they're already in InDesign.
So here I have some manuscript, and it has a bunch of extra returns that I want to get rid of. And I could certainly select each one of those manually and delete them, but I'd rather do them all at once with a Find/Change. So I'll press Command+F or Ctrl+F to bring up the Find dialog box. I'll click on the GREP tab, and then from the Query menu, I'll select Multiple Return to Single Return, and this will transform all these returns into just one. I'll target the Story and click Change All, and OK, and now all those extra returns are gone.
Now, once you get used to working with GREP a little, you can try adding to the existing queries to make them a little more useful for you. For example, that Multiple Returns to Single Return Query is great, but if there is a paragraph where there are straight extra white spaces in it, the query won't find those returns. That's the case where you have the separate story. I'll zoom in a little bit so you can see. And there are spaces and tabs and en spaces and the like in here, and that original query won't find them. So we need to edit it a little bit to make them find all these instances.
I'll put my cursor in between the two returns, and we need to add something here to find those white spaces. I'll go to the menu on the right and pick Wildcards > Any White Space. And because there's more than one, I need to enter that as well. So I'll choose Repeat > Zero or More Times, and then I'll select the text frame, target the story, and click Change All, and now all those returns are gone as well.
I'll zoom back out. And let's look at another example. Sometimes you might want to run a sequence of simple GREP find changes because there's just no way to accomplish everything you need to do with just one query, or maybe it's just too hard to figure out an expression that works in one step. It's great if you can master GREP expressions, but if you're just learning them or if you're on a deadline, it might suit you to do a couple of short easy GREPs instead of a more complex one. For example, here I have a number of paragraphs with some bold text at the start of each one, and the task now is to set off the bold text from the rest of the paragraph with an en space, and I'm going to do that with two GREP queries.
I'll bring up the Find/Change dialog box, and in the GREP tab I want to find the start of a paragraph. So I'll delete what's there, and from the pop-up menu, I'll choose Locations > Beginning of Paragraph. And then I want to find one or more of any character, because I don't know how long this string of bold text is. So any characters represented by a period and one or more times is represented by the plus character.
I'll delete this Change to that was left over from my old query. And now I want to click in Find Format. I'll go to Basic Character Formats > Font Style > Bold and click OK. So now I'm looking for the start of a paragraph, followed by one or more characters that are styled bold. We'll click on Find one just to see if it works. Yep, it's working. All right! Now, what do we want to do with this stuff? In the Change to field we want to keep the found text and then add the en space.
So from the menu on the right, I'll choose Found > Found Text, and then again, I'll choose White Space > En Space. I'll select the Story, target it, and click Change All. And now three en spaces were added. So that's the first step. Now, the second step is to remove the space. So I'll go back to Find What, and now I have an easy-to-recognize pattern.
I have a regular space followed by an en space. So I'll just type in the regular space and then from the pop-up menu choose White Space > En Space and then just change it to an en space, and click Change All. This isn't the most elegant GREP strategy, but when you have to get the job done in a hurry, divide and conquer can be a good GREP strategy. And if you want to learn more about how to write GREP expressions, I recommend you check out Kevin Skoglund's series on using regular expressions.
There are currently no FAQs about Creating Long Documents with InDesign.