In this video, explore the basic building blocks of the GREP code.
- [Instructor] In the previous lesson, we started to build an expression to make sure that our text was fitting that pattern. And I just sort of typed the expression into the field. As you use GREP more and more, you'll actually learn a lot of the expressions and be able to type like that, but to start with we're going to actually access something that's a little hidden. It's a secret menu. In the Find Change dialog box there's actually this little at symbol here, and if I click on it I see that it's actually a menu. So in here are many of the different expressions that I might need to create a longer expression. So to search like I did in the previous lesson, where I'm looking for a digit followed by a period followed by a tab followed by a lowercase, we can build that from the secret menu. One of the main things we're going to use in the secret menu is down here near the bottom, called wildcards. And wildcards are a little less specific, so in this case, any digit, any letter, any character. Because again, we don't know what specific digit we're looking for in this example, we just know that there's a digit and then it's followed by a period, a tab, et cetera. So if we build this expression using our secret menu, we can do that as well. The first thing we're looking for is a digit, and we don't know what digit, so again, if we don't know what specifically it is we can come down here to wildcards. We'll say any digit and that gives us that backslash D that I typed in in that previous lesson. And now I'm looking for something specific, an actual period. I need to type in the actual item that I'm looking for. So we've gone from looking for a wildcard any digit 'cuz we don't know what digit, but I do know that the next thing will be a period. Not any kind of punctuation, not something that I can do with a wildcard, but an actual period. Now in GREP, period means something specific and we'll look at that in just a minute. So what I need to do is what's known as escaping a character and so in this case I'm going to put a backslash and we're going to use backslash a lot. The backslash is on the right side of your keyboard, usually under the Delete key, and I'm going to put backslash period. And the reason I did that is that period is a special character in GREP, so a lot of times you'll find that if you want the literal character you need to add a backslash, because without it, it means something else. And that is a little confusing and it's just something you need to learn. For instance, backslash D means something special, but D alone means the literal lowercase D. I have kind of a rule when I'm creating expressions, is if it's not working and there is no backslash in front of a character I'll throw one in to see if that fixes it, or if there is one I'll take it out to see if that fixes it. So it's a little confusing that sometimes the literal version needs the backslash, such as the case of this period, and sometimes the backslash makes it a special character. And that's just something that you learn the more you work with GREP. All right, so we have the backslash period, we had to add that ourselves, but the next one is going to be in the secret menu. The next thing we're looking for is a tab. And then the next thing I'm looking for is any lowercase character. So any lowercase character sounds like a wildcard to me. Come down to wildcards, any lowercase character. So now I have that expression. Say Find Next, in this particular story and there I've found the expression. In the next lesson, we'll learn how to answer the question "How many" by using the repeat menu.