Please subscribe to watch this video Register
Hi there, in this video we're going to look at how to do a Grep Style. What do they do? They do magic. They are Styles that-- let's say I type in our Business name, 'Maynooth Furniture' As soon as I typed it, it added a Character Style of bold and green. Okay, not pretty, but automatic and magic. Another cool use is, I've got a quote here. Imagine if I have a Style that knew whenever I put a quotation around something, it Italicized it. Okay, I love Grep Styles. So, let's go and learn how to make those now in InDesign.
So Grep Styles are amazing. First of all we're going to open up a document I kind of set up already. It's in '06 Styles', grab 'Grep Styles', open it up. And the way a Grep Style works is that it kind of works like a Nested Style. It's an automatic way of connecting Paragraph and Character Styles. The difference between Nested and Grep Style is that Nested Styles uses the beginning of the Paragraph as kind of Home base. So you can't really work off that. So it's great in the last video where we did Nested Styles, remember, we did our Featured List. Great for Numbered List, anything like that whereas Grep is a little different, it kind of reaches through the entire document. So you need both, really.
What I would like to do is whenever the Business name, you can see it there, Maynooth Furniture, whenever that appears, I'd like it to be bold. It's just what we do, as a business, so I want to automatically do it. So, first of all we need to select all of this, and make a Paragraph Style. So I've got my Paragraph Styles open. I am going to double click it, and this one's going to be my 'Body Copy'. I'm going to click 'OK'. Next thing I'm going to do is create a Character Style. So I'm going to click off in the background. So I've got nothing selected, grab my Character Style, make a new one. This one is going to be 'Business Name'. And I'm going to say, I just want it to be 'Bold'. I'm going to change the color. I'll probably wouldn't do this normally but I'm just doing it just to make it obvious.
So I picked the green and bold. So now I need to connect the two out. So I got nothing selected, back to my 'Paragraph Style', open up 'Body Copy', and in here we're looking for this one, it says 'Grep Style'. Now, 'New Grep Style'. And what I'd like it to do, I'd like it to apply the Style click where it says 'None'. I'd like to apply Business name to the text, delete this. And it's going to say 'Maynooth Furniture'. Click out. You'll see in the background there, wherever the word Maynooth Furniture appears it's going to apply that Style. Click 'OK'. It's a dynamic thing, so it means, whenever I type Maynooth Furniture - yes I have to spell out my spelling. - it will automatically apply. So it's really handy, it's kind of dynamic, and it will always do what it needs to do.
Yours might be just a slight change, you might have some weird thing that you do with your Business name, might be just Italics or Underlined. Whatever you want to do. You might have different kind of versions of that. You can open up Body Copy in here, and say under 'Grep', you might just keep adding them, so when I add a new Grep Style that is just the same thing, but maybe lower case, I know, you probably wouldn't find this in instance, because it's a Business name, but you might be doing it for something else, some sort of language you use in there, so you might have a few different options. Still applies, 'Business Name' Character Style. But it's looking for both lower case and upper case now. Let's click 'OK'. So that's a pretty basic use of a Grep Style, but it's the one that I use the most.
Another thing I'd like to do for Body Copy is, you see here, I've got kind of quotation marks around this kind of, like this inspirational quote here. What I'd like to do is, whenever anything is inside of these quotes I'd like it to be Italicized to make it kind of colloquial. So I'm going to use the same Paragraph Style, but I'm going to create a new Character Style. So nothing selected, 'New Style', click in here. And this one's going to be my 'Quote' and what I'm going to do, under 'Basic Character Format', I'm going to go into here and I'm going to say, actually I'd like you to be 'Italic'. In terms of Character Color, I'm going to not do anything. So what I want to do-- that sometimes happens, it's kind of picking, and I'm like, "How do I unpick it?" Hold down the 'Command' key on a Mac or 'Control' key on PC, and just unselect it.
So if I go into 'General' now, it says, it's just doing Italics. And it's not even doing that, it's 'Based On'. I want you to 'Based On' nothing, I just want you to make it Italic. That’s its only job in the world, this Character Style. Let's click 'OK'. So, I'm going to click off in the background, I'm going to go to Paragraph Styles. I'm going to open up 'Body Copy', and what I want to do is add another 'Grep Style' that says, 'Grep Style'. I want to apply the 'Quote'. When do I want it to apply it? I want it-- see this, I put in two quotation marks. Now I want to double check whether they're using the curly ones or the straight ones. You might just have to copy and paste these in, because they can be different. I know they're straight quotes, it's what I'm using, because I can see them. And inside of here, we need to enter in the Grep code for any character. And it's full stop plus question mark, '.+?', Now I only know that because I teach, and this is one of my favorite teaching Grep codes.
In here, there are bunch of other things in here. So you might be able to build your own. You'll find stuff in here, like 'Wildcards', I want to find maybe any digit that's between those two quote marks. You can apply it. Or any other case that happens to be between quote marks. So you can build out your own Grep codes. I find I end up just Googling them, and copying other people rather than try to work them out myself. I find that little hard. I'll clear off in the background here, and hopefully you can see there, anything between the quote marks is italicized. And I click 'OK'. Let's see if I can make it work again. So you, quote ' " '… it's not working because there's no other side of it. A quote ' " ' mark there. Awesome, huh.
So that my friends is a Grep code. Takes a little while to set up, but can be super useful if you were doing very similar things, very long documents, or for the same client. All right, that's going to be it for Grep codes.