Viewers: in countries Watching now:
Learning GREP with InDesign decodes the language of GREP for InDesign users. It shows how this versatile tool can be used for describing text, which can speed up or automate everyday formatting tasks. InDesign expert and graphic designer Michael Murphy introduces the basic concepts of GREP, and shows how to build powerful expressions using metacharacters. Michael also explores many of the little-known features of GREP, explaining how GREP styles and Find/Change can be used to rearrange data and dynamically format text. Exercise files accompany this course.
The next class of Metacharacters are grouped together under the Repeat submenu in both GREP Styles and Find/Change. Repeat metacharacters will always be used in combination with other metacharacters because all they describe is how often something occurs. When you describe something in a GREP style, it's going to find every instance of that expression no matter how often it appears in a paragraph. That's just how GREP Styles work. So, the best way to show how Repeat metacharacters work and the scope of a Repeat metacharacter is through Find/Change.
So, I'm going to hit Command+F, or Ctrl+ F on Windows, to open the Find/Change dialog and right now it is opened up in Text mode. And I just want to point out the limitations of text-based searching versus GREP based searching in this instance because text-based searching in InDesign, for a while, has included some wildcards in the Special characters for search menu. If I click that menu and go down to Wildcards, I can describe any digit, which is ^9 in a text-based search.
And if I click Find, it's going to find one digit and then another single digit and another, one at a time. If I want to find two digits, I have to put in another ^9 metacharacter and if I click Find, it will find me a pair of digits, but only a pair. It will no longer find me any single digits and it won't find three digits in a row or more. GREP works differently and the flexibility of how GREP works is extremely powerful. I am going to go to the GREP tab and I am going to put my cursor back at the beginning of this text because that's where I want my next searches to begin.
And I am going to click in the Find what field, go to the Special characters menu at the end, and again, I'm going to pick a Wildcard>Any Digit and I'm going to augment that by adding the Repeat metacharacter, one or more times, at the end of it. That's the plus sign, so this expression now reads as any digit one or more times. If I click Find, I'll find that single digit, 2, but I will also find 2005.
The single digit, 7, 0, this 1, but I will find 499 and 00. So I am finding single digits, double, triple and so on. This GREP expression is far more flexible than what I'm able to accomplish in a Text search even though Wildcards exist in Text searches. There is one thing specific that you need to know about these Repeat metacharacters, however, and about GREP in general. GREP, by its very nature, is greedy.
It's going to find everything. It is like an obedient dog that wants to satisfy you and give you everything you possibly could have asked for. But sometimes that is entirely too much. For example, if I wanted to describe any text that exists within parentheses, I might use the expression any character one or more times and put it in parentheses. That would look like this. I'll delete this, go to the Special characters menu and from the Symbols submenu, I can choose Open Parenthesis Character because I have to escape out any opening or closing parentheses.
They have a special meaning in GREP and in order to look for actual parentheses characters I need to escape them out. So that puts it in as \(. Next, I'll type in a period, for any character, and a plus for one or more times, then backslash, close parentheses. I've just described any character one or more times within parentheses. And when I click Find, here is where the problem is. I'm going to move this over. Notice it's found the opening parentheses and then any character one or more times, but a closing parentheses is also included within the scope of any character, so it kept going all the way through until it found the last closing parentheses it possibly could.
If I move my cursor further up in this paragraph and do that again, you can see just how greedy this is. I will click Find and now it's found everything, from the very first opening parentheses through the very last closing parentheses and this is just too much. In order to rein this in and get just what we are looking for, we need to circumvent GREP's greedy nature and limit that search to what's called the Shortest Match. So I'll move this Find/Change dialog up here so we can see a little better and in this expression I am going to delete the plus after the period, so now I'm just describing any one character within parentheses.
And with my cursor still there after the period, I'll go to the Special characters menu to Repeat, but this time I'll choose One or More Times(Shortest Match) and that puts in a plus followed by a question mark. That means one or more times shortest match. Now I'll click Find and that solves the problem. It's found the shortest match in my description of any character, up until a closing parenthesis. If I click Find Next again, you can see that it's done the same thing for this one price, this one and this one.
It no longer expands that search out as far as it can go when you limit it to the shortest match. So Repeat metacharacters provide a great way for you to broaden or limit the scope of another metacharacter beyond what you can accomplish in a text-based search, but because GREP is greedy by nature and always tries to match as much as possible, it's important to know how to rein in that Repeat metacharacter.
Find answers to the most frequently asked questions about Learning GREP with InDesign .
Here are the FAQs that matched your search "" :
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.