Ready to watch this entire course?
Become a member and get unlimited access to the entire skills library of over 4,987 courses, including more Design and personalized recommendations.Start Your Free Trial Now
- View Offline
InDesign contains an incredibly powerful type of style called GREP styles. If often refer to GREP as fine change on steroids because of how powerful it is. Now, GREP stands for Global Regular Expression Print or General Regular Expression Print. Or actually it seems to depend on who you ask. I'll tell you what, if you every lose any InDesign trivial pursuit question because you didn't know, you can blame me. But seriously, GREP styles allows you to perform some amazing formatting features that would normally be a very time consuming process. GREP can be applied in two different ways.
One method is by going to the Edit menu and choosing Fine Change. You'll notice you have a GREP section in here where you can perform GREP searches. Now, using this method, you can actually change text in your document. Now, I'm going to click on Done because the way that we're going to use GREP in this video is by using GREP styles. And GREP styles can't actually replace any text but it can format the text that is there in powerful ways. I'm going to zoom in on the right panel on this page.
I'm going to do that by holding down Cmd+Space bar on Mac or Ctrl+Space bar on Windows and just marqueeing the top area here. Now to clean this up a little bit, I'm just going to switch to my Type tool and I'm going to click inside of upcoming events. And I'm just going to apply the Subhead style to that text. Now, next, I want to incorporate GREP styles into this text. And just like with nested styles, the first thing we're going to do is actually create the paragraph style that we want to apply to this text.
So, I'm going to highlight this text. And I'm actually going to apply body to this text first. And that'll be my starting point. Now, I'm going to create a new style, so I'm going to hold down the Option key on a Mac, or the Alt key on Windows, and I'm going to click the Create New Style button. And I'm going to make sure that I name this style Events. Click OK. And now we have this new style applied to this text. Now, we're going to make a couple of minor changes to this. So, the first thing I'm going to do is highlight this text and change this text to Myriad Pro Regular.
I'm going to change the size, it's 13 over 15, that's good. And then I'm going to go to my paragraph formatting, And I'm going to apply a left indent here of one p. So, I'm just going to highlight that field and type one p, press enter and that's going to indent all of my text to the left. Now, in the first line indent field, I'm going to highlight that value and type minus one p. And that's going to create a hanging appearance for my text. Now, that looks pretty good, and in my Events style I now have a plus sign indicating that local override. So, I'm going to right-click on Events and choose Redefine Style so that I've incorporated all of those changes into my style.
I can click anywhere within that text, and the first thing I'm going to do is apply a nested style to format the event as bold. So, to do that I'm going to right click on event, and choose edit events. And if I come down to drop caps in nested styles, I'm going to click new nested style. And I'm going to tell it to apply bold through 1 and where it says words I'm going to click on that and I want to enter N dash. And I can do that by holding down the Option key on Mac or the Alt key on Windows and then by pressing the hyphen key on my keyboard.
And if I click below that we should now see that the event is now being applied through that first N dash. Now to apply the GREP style, I'm going to click on the GREP Style category. Now let's take a look at how GREP styles work. I'm going to click on New GREP Style and by default, it's going to create a basic GREP style for me to start with. So, where it says, apply style, it currently says, none. So, I'm going to click on that and I'm going to choose bold from the list. If I click down here, you can see that what it's doing right now is, it's applying bold.
To text that is a digit, okay? And more specifically, it's applying it to a digit that can occur more than once. So, you can see right now every digit in my text is being formatted as bold. This is pretty powerful. And at the most basic level, we could do it in a very easy way. If I click on the To Text menu, I can simply type a word so that it finds that word. So, in my text, if I always wanted a certain word to be formatted, I could just enter it here. Let's go ahead and type, in this case, Jan for January. And if I click off of that we can see that every instance of January is being highlighted as bold.
So, this is pretty powerful. Now we're going to build a more detailed GREP search. Because anywhere that I have a date, I want to make sure that I'm formatting it properly. So, we're going to build what's called a GREP expression. So, where it says To Text, I'm going to click inside of there and the first thing I'm going to do is I want to find any January that has a period behind it so. For my To Texts, I'm simply going to just type Jan with a period behind it.
Now, in addition, I want to make sure that the digits behind it are formatted, as well. You gotta pay attention to, to the fact there is a white space after the word. So I'm going to come over here to this little at symbol. And this allows me to choose from a bunch of different choices that I can use to define or find different areas. So, what I'm going to do is in the Wild card section, I'm going to choose any white space. You can see that puts a back slash S to indicate any white space. Then after any white space, I'm going to make sure that it finds a digit. So, I'm going to click on this At symbol again.
Come down to Wild Cards and I'm going to choose any digit. And just to make sure that this is working I'm going to click underneath here to kind of refresh this. And we can see that it is in fact finding January followed by the first digit. But as you can see here, it's missing that second digit. This is where GREP really shines. I'm going to click inside of here again, put my cursor after the backslash D. Because I want to find any number of digits in a row. So, if I click on this at symbol again and I come down to repeat.
I'm going to choose one or more times. And if I click underneath here to refresh this, you can see that it's now including that second digit, because it's looking for any digit that appears one or more times. Great. Now, in addition to this, I also need to account for if there is a range of dates as you can see here so what I'm going to do here is after this plus sign, I want to find a hyphen. Now, I could just type a hyphen on my keyboard.
But that could cause a problem because in order to find a literal character in GREP. I have to do what's called escaping out of it. And to do that I just put a backslash in front of that hyphen. Escaping out essentially means that it's not suppose to use that hyphen as part of the GREP expression. It simply is suppose to find that hyphen literally. And the thing is that hyphen is not always going to be there is it.
You can see that after some of the digits, It just stops, there's no range. So, we have to build some intelligence into this. So, after that hyphen, if I put my cursor there, I'm going to click on the At symbol and go down to Repeat, and I'm going to choose Zero or One Time. Which means it could be there, and it could not be there. And, if I click underneath here, you can see that now my GREP search is now still working. Perfect. Now, after that question mark which indicates zero or more times, I need to find potentially another group of characters.
Such as down here. So, after that question mark, I'm going to go ahead and go to the at symbol. Go to Wild cards and choose any digit. Remember it could be two digits. So, I'm going to go to the at symbol again. Under repeat, and choose one or more times. Now, the thing is I want to group that digit so that I can deal with it in a unique way. Because I basically want to say that that second range of digits may or may not be there. So, to group it I'm just going to put parenthesis around that backslash D plus sign to treat it as a unit. And then at the very end here, if I click on the At symbol, I'm going to go to repeat and choose zero or one time.
Now, to really test this, I'm going to go ahead and click OK. And what would happen if I came in here after January 22nd, and I typed dash twenty third? Notice that it is in fact working the way that I want it to. So, I'm going to delete that text. So, that worked pretty well for January. But, now I need to update it for the rest of the months. So, I'm going to go ahead and edit that events style again by right-clicking on it and choosing Edit Events.
I'm going to go down to GREP Style, and I'm going to click on the text inside of here. And I'm going to make sure that this text is selected, and I'm just going to copy it by pressing Cmd+C, or Ctrl+C on my keyboard. After the question mark, I'm going to insert a Pipe symbol. You can do that by holding down the Shift key on your keyboard, and pressing the Backslash key. And the pipe symbol in a GREP expression indication or. So, after the pipe symbol, I'm going to do a paste and I'm going to change that next month now to February.
So I'm going to type Feb. Then I'm going to scroll to the end. And what I usually do is I'll just hit my right arrow on my keyboard to get my text all the way to the end of this text. And I can press Shift Backslash to do another OR operatoraAnd Paste this again. And I'm going to change the month to March this time, Mar. So, essentially what this is saying is find any date that begins with January, February, or March followed by any of those digit sequences that we defined. And if we click underneath here we can see that now February is being updated. You can also build these GREP searches in a text editor or whatever you feel comfortable with and then just pasting it into this field. Because you have a limited amount of space to work here. So, if I click OK.
I'm now going to apply that event style to the second paragraph. So, if I click on Events, we can see how it's automatically formatting those dates. If I click in here again and apply events, once again, we can see how this is working. So, this, essentially, bulletproofs your text because if I type some additional text here, I could say also. Between March 15th and 18th you can, and then whatever it might be, you can see that it's automatically going to format this text.
Whether you flow it in or whether you type it in, this GREP style is really taking care of a lot of the work for you. To update everything, I would need to go back into that GREP style and add the rest of the months that could appear in here. But as you can see formatting content in this way manually would take a fair amount of time and really opens up the possibilty for human error. When you have formatting that needs to be applied to defined areas of text, remember that GREP styles could save you a ton of time.
- What are styles and why should I use them?
- Setting up and applying styles
- Dealing with style overrides
- Text styles
- Object styles
- Table styles
- Using style groups
- Sharing styles between documents