Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
If you're familiar with, or have used Nested Styles, which have been around since InDesign CS, you may be wondering what the specific advantages of GREP Styles are versus Nested Styles. Nested Styles are powerful and very easy to use, but they do have certain limits and once you reach those limits and need to do more, you need to use GREP Styles. Let's take a look at the basic differences between one and the other. In this document, there are a number of Embassy listings and for each there is a phone and fax.
The line with the phone and the line with the fax, each start with a Nested Style, that styles the word Phone and the colon, the word Fax and the colon, differently from the rest of the line and it does it automatically. I am going to put my cursor in one of those styles. Open the Paragraph Styles panel and we can see the Fax style is selected. So, I am going to right-click on that and choose Edit Fax. I will go to Drop Caps and Nested Styles and in the Nested Styles area, you can see there is a character style called Phone and Fax Lead-Ins that's automatically applied through one colon, and that's how this automatic styling is accomplished.
In the Phone style, it's set up exactly the same way. Now, this is very convenient and easy. You pick a style from this list. You choose how far that style extends, through or up to a specific number of an ending criteria, at the end. So, it's very simple, structured and easy to use, but that structure is very rigid. All Nested Styles start at the beginning of a paragraph and they have to follow a very rigid uniform path through the paragraph.
Any variation from that and the style will not work as intended. Now you can easily re-create this exact same functionality in a GREP style. In fact, I am going to do that very quickly here. I am going to delete this Nested Style and you can see that fax is no longer styled in any of these paragraphs the way it was before. Now, I am going to do the exact same thing with a GREP style. I am going to create a new GREP style and I am going to apply the style Phone and Fax Lead-Ins.
When I click on here and notice it's highlighted, Any digit One or More Times, and not what I want. And if I am structuring this, much the same way as a Nested Style thinks about it, a Nested Style would consider this whole style to start at the beginning of a paragraph. So, I will choose the Location metacharacter>Beginning of a Paragraph and then after that I can type the word Fax and a colon and click off here. That's one way to do it. I could also type the Any Character metacharacter and then One or More Times followed by a colon.
That accomplishes the same thing. There are a few different methods for doing it in GREP, but depending on what you're comfortable with, this is no more or less effective than doing a Nested Style. Picking them from the list in Nested Styles is quite easy and if a Nested Style gets the job done for you, then by all means use a Nested Style. But unless there is a rigid structure that is uniform across the entire paragraph, a Nested Style is not going to adapt to unpredictable situations, the way that GREP can. And there is an example of what I mean, right here, in this paragraph.
This Ambassador's name is an Arabic name that begins with al hyphen and because InDesign allows even text with hyphenation turned off to hyphenate at a typed dash this name, which is a proper name, is being hyphenated and that's just not appropriate. It should all be on one line. So, I want to account for any instance of any of these names that start with al- and apply a No Break attribute to them. And this is not something I can do with a Nested Style because I don't know where this is going to occur in the paragraph. I can't set up a rigid structure.
So, I am going to cancel out of this and I am going to put my cursor in this line and it highlights the Ambassador paragraph style, in the Paragraph Styles panel. I will right-click on that, choose Edit Ambassador and I am going to go to GREP styles and create a new GREP style to fix this problem. I am going to click New GREP Style here and from the Apply Style menu, I am going to choose an existing Character Style out of this list called No Break. The only thing this does is apply the No Break attribute.
Everything else about the Typeface, Color, Size is left undefined. And what I want that applied to it is the Beginning of a Word from the Locations submenu, followed by al- and then Any Character, so I will type a period for Any character, because I don't know what's necessarily going to follow the beginning of that surname. I'll click off here and let's see what we get. Beautiful! It has kept those two together that name will not break and no other instance of that name will break anywhere else.
And I haven't had to define where it falls within the paragraph. I just want to make sure that it's at the Beginning of a Word, so that's why I included the Beginning of Word metacharacter. Let's take a look at how well this has fixed the problem document wide. I am going to go all the way to the end of this story and just move over here because I happen to know that there is an instance of this also under Yemen. This is another name that starts with al-, but it continues on with a different letter following it.
And it has fixed this too. I am going to actually select these letters and go up to the Control panel and you can see that the No Break attribute is applied to this and it was done dynamically by the GREP style. This is something that a Nested Style simply can't do because of its specific order and limited set of rules, but a GREP style can because it has no such limitations.
Get unlimited access to all courses for just $25/month.Become a member
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.