The easy way would be to do the reverse of what you're trying: set all of the paragraphs to your NameListingAddress style (rather than NameListing). Then do a plain old ordinary search for Tabs, put nothing in the "Change To..." line (or put another tab in) but set Change Format to the NameListing paragraph style in the popup menu. Change all (after you've checked a few to make sure it's doing what you want).
There probably is a way to do this with GREP but it would be a lot harder.
Worked like a charm, thanks Rodney! Originally I assigned the name style because it's easier to find (manually) the leader dots. But that makes total sense, and even the ones with out phone numbers have a tab (which I'll have to go in and remove, along with extra spaces and hard returns between listings).
Sometimes all it takes is a different point of view to solve a problem. Thank you!
If there are OTHER tabs that don't belong, you may be able to use a GREP to find and eliminate a lot of those. First, I'd remove all spaces following tabs (using the regular Find, search for ^t-space and replace with ^t).
Then, it looks like the tabs you want to keep all have an open-parenthesis after them, which is part of the phone number. GREP can find all tabs that don't have an open parenthesis so you can replace them with a space (to avoid words separated by a space being made into one word). You'll want the "negative lookahead" option from the popup menu. Find:
\t is the tab, (?!x) is the negative lookahead for finding something NOT followed by x, and \( is the open parenthesis with an escape backslash so that GREP knows it's a REAL parenthesis, not part of a GREP code.
Replace with a normal space. Then, I'd run a search to change all double-spaces to single spaces, in case you introduced extra spaces during that step.
Woo eee--complicated! but I think I follow. The only tabs, fortunately, that don't belong are the ones with no phone numbers following. I assume the individuals don't want their phone numbers in the book, but when they pull the list, they don't (or can't) remove that extra tab. Regardless, it's been useful for me, for a change.
My leader dot tabs all have a space before and after. I can put them back in after I delete them all, though, as find/change is how they got there in the first place.
Even with all this automation I still have to visually search for name/phone entries that are too long and don't fit on one line, and either fuss with tracking/kerning/horizontal scale or reconfigure with a logical and attractive line break. But this keeps me from getting cross-eyed, THANK YOU!
If your intent here is to use the character style to trigger a variable, as I belive it is based on your other thread, you MUST apply the character style up to the first tab to pick up the text at the start of the paragraph. There are two approaches to automating the formatting after that, but it may be too late for you to be much help.
In cases where every listing has the same number of lines it makes sense to use a unique paragraph style name (not necessarily format -- base on on another) for each lline and make it its own paragraph. Set up "next styles" to rotate through the list so each line is assigned the correct style based on the style of its predecessor. You get the rotation to sart over by making the first line style the next style for the last line. This works for manual entry and can be applied to an entire block of placed text in a single operation by selecting the text, then right-clicking the name of the first style to be applied and choose Apply <stylename>, Then Next Style.This ONLY works if you have exactly the same number of paragraphs in each listing.
The other option is to use forced line breaks instread of paragraphs and use one style for the entire listing. Set a left indent and negative first line indent, create a character style for the part of the first line that you want to appear in your header and apply it Up To ^t^n (that's a little-known trick -- if you enter more than one character in the trigger for a nested style it will activate on the first instance of any of the characters listed that occurs, so for example if you enter the word cat, your style will end on the first, c, a or t that appears inthe paragraph. ^t is the metacharacter for tab, and ^n is for forced line break) so that the style will end at either the tab, if present, or the forced line break if there is no tab (if you use a right-indent tab instead of a regualr right aligned tab [tricky to do a leader, but that's another discussion] substitute ^y for the ^t), then add a nested Line Style for one line. That line style should use a second character style that is based on the first character style you created for the name text and has no other attributes if you want the line to be the same from end to end. Sounds more complex than it is, and will work for listings with variable lenghths. The trick is to repalce your paragraph returns with forced line breaks, and will require a little thinking.
If using separate paragraph styles for each line, you'd use the same technique of a nested style up to a tab for the first line, but there is no need to get fancier since it will apply to the whole line if there is no tab. The paragraph style, in this case, would carry all of the bold and size formatting (and no need for any indents), and the character style would be nothing more than a name that will allow you to use it in the variable.