Hi there! In this video you’re going to learn about GREP Style. Ya, I know, it sounds like a
weird name, but it’s an abbreviation of ‘globally search for a regular expression and print.’
It’s a really powerful feature of InDesign, and particularly for bookmaking,
or for texts, that need to have repeated words or characters, so let’s learn how to do it.
I already have my paragraph and character styles panel showing here, so if yours are not showing,
just go to window, and then styles, and you shall find both of them sitting under it.
The shortcut to show the paragraph styles panel is Command F11 on a Mac, or Ctrl F11 on a PC,
and for character styles panel is Shift Command F11 on a Mac, or Shift Ctrl F11 on a PC.
Let’s grab the text tool, and make a large text box. Right-click, and fill it with
placeholder text. Since our text is all junk characters, I’d rather add some real words to it.
Let me type in the word ‘automatic.’ I’m going to repeat the word here as well.
In fact, let’s copy the word, and paste it, one last time.
Similarly, I’m going to add amounts as well, so let’s type in $2400, and then select
and copy this. Now I’m going to paste it at any random location, and change the amount to $800.
Don’t worry, you’ll know, soon enough,
why we’re doing this. Let’s copy it once more, and change the amount to $2330.
Lastly, I’m going to add another word ‘touching’, and then I’m going to copy, and paste it here,
and I’d like to have the word in its base form as well, so let’s type in ‘touch’,
without the ‘ing.’ Perfect! Now the boring stuff is over, so let’s hit Command A on a Mac,
or Ctrl A on a PC, to select all, and then click the small plus button at the bottom of
the paragraph styles panel. Double-click the new paragraph style, and rename it
‘body text.’ Go to ‘basic character formats’ tab. Let’s change the font to ‘Arial’, and hit okay.
Our text has a paragraph style now. Let’s double-click the body text paragraph style,
and on the left column, you should find the ‘GREP Style’ option, so click it.
Next, hit the ‘New GREP Style’ button. Click just next to the ‘Apply Style’ option, to reveal
a dropdown menu. At this point, no character style is showing, because we never made one,
so let’s make one now, by clicking the ‘New Character Style’ option.
Let’s rename it ‘bold’, cuz I can’t think of any name, at this point. Go to ‘Basic
Character Formats’ tab, and select ‘Arial’ as your font, and change the font style to ‘Bold.’
Now go to the ‘Character Color’ tab, and pick the pink color, and hit okay. Now click next to
the ‘To Text’ option, and remember we typed in the word ‘automatic.’ Type in ‘automatic’, exactly the
way you typed in earlier, so if it was in capital letters, you should type it in capital letters
here as well, else GREP won’t work. The moment your cursor leaves the cell, you’ll find the word
‘automatic’, getting highlighted, rather taking effect of the character style you just set for it.
Let’s head to our text, and randomly pick any location, and add quotation marks. I have added
quotation marks to this phrase here. What I’m trying to do is, make a new GREP Style, in
which any instance where I add opening and closing quotation marks, it should inherit the character
style I set. This time let’s make a new character style, straight from the character styles panel,
by clicking the plus button. Double-click the new style, and rename it ‘quotation.’
Let’s go to ‘basic character formats’ tab, and change the font to Futura,
and font style to medium italics. Let’s go to ‘character color’ tab, and change the color to
‘green’, and hit okay. Let’s go to body text, and then the GREP style, and add a new grep style. In
the ‘apply style’ option, let’s pick ‘quotation’, and in the ‘to text’ option, let’s add “.+?”.
The moment you click anywhere outside of the cell, the character style will take effect,
so hit okay. Now let’s add quotation marks to see if they work with new instances as well, so
I’m going to add the opening quote, and then the closing quote, and voila! It works like a charm!
Let’s go to GREP Style once again. Add a new grep style, and in the ‘apply style’ option,
click ‘new character style’ option. Let’s rename our new character style, ‘touch.’
Go to ‘basic character formats’ tab and change the font to ‘Poppins’, and font style to ‘semibold.’
Also, change the character color to ‘blue’, and hit okay.
Now in the ‘to text’ option, if I type in ‘touch’, and come out of the cell, you’ll find that,
not just the word ‘touch’, but the word ‘touching’ has also taken effect of this new style,
which we never wanted, so to fix that, click the cell where you typed in ‘touch.’
Ensure that the word is not highlighted. You shall find the ‘@‘ sign right next to it. Click it and
it shall reveal a wide variety of options you can play with. Let’s go to ‘locations’,
and then ‘end of word.’ This tells InDesign that the word ‘touch’, is the target word,
and it shall not go beyond it. The moment you select the ‘end of word’ option, you’ll find that
now, just the word ‘touch’, is highlighted, like we wanted it to be, so let’s hit okay.
Let’s discuss one more feature of GREP, so let’s get back to GREP style. Click ‘New GREP Style’
option. Under ‘apply style’ option, let’s make a new character style. Rename it ‘dollar’, and
then go to ‘Basic Character Formats’ option. From here, change the font to ‘Museo Sans Condensed’,
and font style to ‘700.’ Move on to ‘Character Color’ tab, and select red as your color,
and hit okay. In the ‘to text’ option, if you enter $2400, you’ll find that it is not
highlighting the amount in the text. It’s because the ‘$’ in itself is a special character of GREP,
so it won’t work here. What you need to do is, add a ‘\’ before $2400, but does it solve our problem?
I can see that only $2400, is highlighted, but $800 hasn’t picked the character style yet.
What we need to do is delete the digits, and let’s just have ‘\$’, and then click the ‘@‘
sign on the right, and go to ‘wildcards’, and then ‘any digit.’ You’ll see that this action has added
another ‘\’ and a ‘d’ to our recipe, but has it solved our problem? I don’t think so, because now,
I could see just the ‘$’ sign and the first digit after it, getting highlighted, which means,
we still need to do something more. Click the ‘to text’ option once again, and then click the
‘@‘ sign, and go to ‘repeat’, and under ‘repeat’, select ‘one or more times’, and you shall find,
it has added a ‘+’ sign to our equation now. This time, our job is done, as we expected it to be,
so hit okay. I think we added another amount somewhere, here it is! You’ll find a cheatsheet of
major GREP styles in the exercise files, so do try some of them. Since GREP uses codes to describe a
text pattern, it’s not possible to remember all of them, and you don’t need to as well,
but do make good use of them, and I’m sure you’ll love them. I’ll be covering a few
topics based on GREP in the upcoming unit as well to ensure that you fall in love with it.
Alright guys, that concludes our session, grep a cup of coffee.
Oh sorry, grab a cup of coffee, and I shall see you in the next one.