Expressions in the Find/Change dialog box
Save often-used GREP searches
Use built-in expressions
Use Find/Change to build an expression
I use the Find/Change dialog box to build all of my expressions, even if they’re going to eventually end up in a paragraph style. The reason for this is that I can build it and see the results immediately. When I’m actually conducting a search with the Find/Change dialog box, there’s a few things that I like to make sure I do. And one of them is that I like to keep my search very localized. So for instance, if I were running that phone number search, I would select this frame and then choose in the Search field to only search by the story. And that’s because there might be text on another page that fits the pattern, but if I’m not seeing it, I might not realize that I’ve actually changed it.
So on this frame, on this story, I’m going to go ahead and run that phone number search. And then I’m just going to tell it Change All. And it changes everything inside that frame. But the second number doesn’t look all that great. And that’s because it wasn’t a phone number to begin with. It was a 13-digit part number. But because I told it to change everything in that frame, it took the first 10 digits of that part number and formatted it how I want my phone numbers to be formatted. That’s not what I want to do. So I’m going to undo that and I’m going to get even more specific.
I’m going to select just the text that I know is a phone number and say Change All. And now it just formats that. I also—if I had several of these digits, sometimes phone numbers, sometimes part numbers, all in the same frame—I don’t want to have to actually find each one and select it. I just want to go through the story and change everything. But because it’s mixed, I might not be able to target as well as I’d like to. In that case, I can target just the story and then do what I call “semi-automatic find change.” Where I tell it to Find Next, so it finds the first one, and I’m going to tell it to change it and then find the next one. So it changes it, finds the next one. I can see that I don’t want it to do that one. So then I can just say Find Next. So while it doesn’t do it with just a push of one button, it’s certainly a lot quicker than finding the individual text and then having to manually style it. I’ll say OK to that and we’ll actually undo that.
So you saw that I pulled down this query from this menu that’s here. And we have a ton of them. You probably have fewer. And as you can see, there’s a lot of them in this list. Everything in the middle between these grey lines, which are very hard to see, are GREP searches. So it all applies to the searches that are here in this GREP tab. So once I’ve created an expression that I like, I can actually save it. I can come up here, to the little save query icon. Click that and we’ll give it a name. We’ll just call all it New Query 2. And we’ll say OK. And now that’s in our menu. Next time we need that, we can just choose that from the list.
Now, there are a few that are actually built-in and come with InDesign so that you don’t even have to think about the expression. We just pull it from the menu and it’s there for you. On this page I have some imported text and it comes in with some problems like a lot of imported text does. For instance, I have double spaces after some of the punctuation. Now, a lot of us will just simply go over to our Text Field and say find “space, space” and replace with a space. I’m sure a lot of you have done that. We don’t want to do that anymore. Because, for one thing, what if you get somebody who decides to put three spaces after something? That happens a lot. We’ve got three spaces. We’d have to run that find/change a second time or a third time. Or maybe they’ve used some specialized spaces. Or maybe they’re like this person and they just put a ton of them there at the end, for whatever reason.
Instead, we’re going to go to the GREP tab. We’re going to choose from the query menu one of the built-in expressions called Multiple Space to Single Space. I’m going to select just this story. And I’m not going to worry too much about what this expression says because, again, it’s built-in…the work’s already done for me. But what it says is to find all the different types of spaces that there might be, where they occur two or more times, and change it to a space. So in this story, I’m just going to say Change All. It changed it in five different places. We now no longer have those double spaces there. We don’t have the double strange spaces. We don’t even have all of those at the end.
One of the other built-in queries that we have is Find Multiple Return to Single Return. Where we’ve got these extra returns in between our paragraphs, we want to get rid of those. So again, I just choose it from the menu. It fills in the actual expression. All I need to do is to tell it to Change All. It took out those extra returns. It left the one that we need to tell it it’s a new paragraph, but it took out the extra ones. We would then just take this and maybe add some space in between those paragraphs.
I also like to use the Find/Change dialog box to actually build my expressions, even if those expressions are going to become part of a paragraph style. And the reason for this is that I can build an expression piece by piece and continually check that it actually finds the text that I’m expecting it to find.
In this case, I’d like to find a digit, followed by a period, followed by a tab, followed by a lowercase character. Because I can see that I sometimes have lowercase and sometimes have uppercase, and I’d like to change it all to uppercase. But only when it follows the digit, the period, and the tab. So I’m going to go ahead and target this frame. I’m going to tell it search only by this story and then I’m going to start building my expression. Again, don’t focus on what the expression says, just sort of how I build something and check it, build it and check it. So we’re just looking at the process.
So I’m gonna put in the expression for a digit and I’ll say Find Next. And it finds that digit. Great. I’m gonna put in the expression for finding a period. And I’ll say Find Next. OK, good. I’m gonna put in the expression for tab. Find next. So I can see that it is finding the pattern I’m expecting it to find. And the last thing is the lowercase character. Find Next. Great, it finds that. Now I want to make sure it finds everything in this frame that I’ve set up. So I’ll say Find Next, Find Next, it skips over that one because that’s not a lowercase character. And Find Next. So I’m pretty confident that that is a good expression. I could then save that if I want to or just go ahead and run it on this frame or on the entire document.
So those are a couple tips that I use when I’m looking for something. I’m using the Find/Change dialog box and sometimes I’m even going to take that expression and move it into a paragraph style.
In the next lesson we’ll actually start creating our first expression.