New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

7. Mastering GREP

From: InDesign CS4: 10 Habits of Highly Effective Pros

Video: 7. Mastering GREP

This video title talks a lot about automating things in InDesign so that you don't have to do certain tasks by hand. Take Find/Change, for example. I mean, where would we be without our friend Find/Change, to zip through a document and incidentally change 300 instances of one thing to another? So like, for example, in this document that I've opened, the chocolate catalog, which is in the Exercise Files, you can see that the person apparently is using a foreign way of spelling chocolate. So I could easily just select all this text and go to Find/Change and say find every instance of chocalates, spelled like that, and change it to chocolates.

7. Mastering GREP

This video title talks a lot about automating things in InDesign so that you don't have to do certain tasks by hand. Take Find/Change, for example. I mean, where would we be without our friend Find/Change, to zip through a document and incidentally change 300 instances of one thing to another? So like, for example, in this document that I've opened, the chocolate catalog, which is in the Exercise Files, you can see that the person apparently is using a foreign way of spelling chocolate. So I could easily just select all this text and go to Find/Change and say find every instance of chocalates, spelled like that, and change it to chocolates.

I'll say Find and Change and Find Next and Change and then maybe I will do it over here in this one too, because I think we have the same problem here. I'll just say Change All. Yeah, that's about it. Can you imagine doing that on your own, in paragraph after paragraph? Well, a GREP Find/Change, which was introduced in CS3, increases the power of Find/Change exponentially. It's clear that Adobe realizes how useful GREP features can be in a page layout program because we also have in CS4 Paragraph Styles. We are able to actually include GREP commands within the Paragraph Style.

So who knows what we're going to see in CS5, right? We could have GREP pages and GREP documents. Power users really need to get their heads around what is GREP and don't let the word itself scare you. So my friend David Blatner has done a fantastic title called 10 Things that InDesign Users Should Know about GREP. I encourage you to watch that, but just to show you what I'm talking about in this video, let's talk about two ways we could use GREP in this one document. Now GREP, by the way, stands for General Regular Expression Parsing and all it means is that in Find/Changes, instead of doing a literal search for these characters and replace with these characters, with the GREP Find/Change, though you can't do that search for literal, one string and change to another string, it's mainly meant for pattern-based searching.

So like, for example, let's say that we wanted to apply a Character Style to all of the prices in this catalog. If we used regular Find/Change, we'd have to search for $12 and then apply the Character Style and then search for $8 and then apply the Character Style and so on. But with the GREP Find/Change, we can construct a little GREP query here that will find all patterns of prices. I've already created one and I've saved it called Find Price. Now you probably don't have that in your document, but let me step you through this and you can just enter if you'd like.

It says Find every instance of a $ sign. Now because a $ sign is a GREP code that can mean something different, whenever you want to find a literal $ sign, you have to put a \ in front of it. That means escaping it. Find a $ sign that's followed by any digit, plus a period, followed by one or more digits. So let's just see how that works. We don't want to change that text, but we do want to change the format. So, for example, I might want to change the -- apply a Character Style like say red to all prices. So, we'll start here and we'll say okay, Find.

And it found the first instance of $12. So we'll say Change, so to apply the Character Style to that and then say Find Next and it found $8 as well. We can just say Change All and it went through the entire document and applied that Character Style to every single price. So you can see how useful GREP can be in Find/Changes. It's also quite handy in Paragraph Styles. Now this Paragraph Style here is description. Let's say that every time that we mention the word chocolate in this chocolate catalog, you want to put a cool, little emphasis on it. We want to apply a Character Style that I've already created called emphasis.

Although we can do this very simply, just by going to the GREP Style panel for description and then entering a new GREP style, you want to apply the style called emphasis. We do not want to apply to numbers, you see that's the default, little tag there, and you could see it automatically applying it to numbers. We want to apply it just to the word chocolate, so we can just enter this straight literal text there. So every time it finds the word chocolate, it's going to apply this little bit of cool formatting. That means we don't have to keep running Find/Changes to search for chocolate. If I add the word chocolate right here, it automatically gets formatted.

That's the power of GREP Find/Change. So the next time you find yourself running a series of Find/Changes over and over again, with just a little bit of variation in between them, try a little GREP instead. It may take you a little while to get it right, but the time it's going to save you in the long run will be well worth the effort.

Show transcript

This video is part of

Image for InDesign CS4: 10 Habits of Highly Effective Pros
 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold

Are you sure you want to delete this note?

No

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.