Skip to main content
Inspiring
November 16, 2012
Answered

Apply nested style up to one of several possible characters

  • November 16, 2012
  • 2 replies
  • 3517 views

I d-i-d give this the old college try, but maybe I dont know the right place or I'm limited by Nested Style or by GREP style.

I have any number of predictably unpredictable characters that I want to apply a CH style "up to"

Example 1:  The InDesign Club of the Future Meeting, 3:30 pm:  Here is some sample text ....  Here is some sample text ....  Here is some sample text ....   — in this case, "up to" colon
Example 2:  The InDesign Club of the Future Meeting, 3:30 pm - Here is some sample text ....  Here is some sample text ....  Here is some sample text ....   — in this case, "up to" space hyphen space

Example 3:  The InDesign Club of the Future Meeting, 3:30 pm -- Here is some sample text ....  Here is some sample text ....  Here is some sample text ....   — in this case, "up to" space hyphen hyphen space

Example 4:  The InDesign Club of the Future Meeting, 3:30 pm, Here is some sample text ....  Here is some sample text ....  Here is some sample text ....   — in this case, "up to" any character (comma) [of course, there's an argument in this one]

There are 5-6 predictable samples.  But Nested Styles stacked on top of each other tends to bold the whole paragraph.  Would a js script be more applicable here or do you see GREP style working?  I have failed (even with my books on GREP) to nail any type of pattern down.

This topic has been closed for replies.
Correct answer Peter Kahrel

How will you tell the difference between the first and the second comma in Meeting, 3:30 pm,? They're both followed by a space. Can pm be the clue? Then ^.+?pm\s[:,-]-? might work.

Peter

2 replies

Peter KahrelCommunity ExpertCorrect answer
Community Expert
November 16, 2012

How will you tell the difference between the first and the second comma in Meeting, 3:30 pm,? They're both followed by a space. Can pm be the clue? Then ^.+?pm\s[:,-]-? might work.

Peter

MadMac55Author
Inspiring
November 16, 2012

Right on the nose, Peter.  I need to go back to your book and read exactly the statement your GREP is making. 

MadMac55Author
Inspiring
November 16, 2012

Peter, it's another thread for this.... but it's interesting that scripts work for hours one night, and then don't behave in the morning.  Nothing changed except for the Mac that shut down and restarted.  This is all new and it's confusing as where to begin to research it.  Have seen it lately on all variations of the Find Change by List.

Vamitul
Legend
November 16, 2012

use a GREP style instead of a nested style.

something like this ^.+?[:-–] etc

MadMac55Author
Inspiring
November 16, 2012

Tried it, but no luck.   Thank you Vamitul.

Vamitul
Legend
November 16, 2012

you shure? how did you define the grepStyle? for me (win, id 5) it works perfect.