Find expressions in the “secret menu”
Wildcards to find any (digit, letter, character, etc.)
\d \w \l \u \s .are common wildcards
Sometimes you have to “escape” a character
.) will need to be escaped by placing a backslash when referencing the literal character.
In a 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, etc. 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. And we’ll say any digit. And that gives us that backslash d <<\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—because 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 wild card, 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, \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 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 found the expression.
In the next lesson, we’ll learn how to answer the question, “How many?” by using the Repeat menu.