GREP Question: Style em spaces that precede only certain triggers within a paragraph


i've been asked re-post indesign grep question here under scripting...

 

hello,

 

up front:

i not know grep enough begin to tackle this.  , usual, i'm in pinch!

also, if you're visual type, @ second last paragraph @ bottom, , may enough devise grep style.  otherwise, bear me, have think through...

 

i have list spans pages of events.  events formatted follows:

box city eventnamespecific month endpara (this single paragraph in story of hundred such paragraphs)

 

on paper, each event need preceded filled specific-colored box ().  box made strikethrough applied em space using grep, since easy create using character style , requres 1 setting (the thickness of strikethrough).

 

there legend @ bottom of page, detailing 14 types of events.  of different types of events require same colored box.  in have 7 different colors of boxes in legend.

 

i'm looking create...

 

  • 7 character styles, 1 each color (consider done already)
  • 1 paragraph style (essentially done, missing grep)
  • 7 grep styles (or more necessary) apply em space precede specific sets of text strings
    • if need, or if simpler create 14 grep styles within paragraph style, that's fine.  understand may able this... (target phrase 1 | target phrase 2 | target phrase 3) in between parenthesis identify multiple possible triggers within same rule.
    • i'm fine whether it's 7 or 14 rules in there, want able update them on course of time necessary - won't season @ least if do.

i don't know grep enough piece need.  vaguely familiar look aheads , look behinds.  understand may easier if em space in between other characters, in example below i've inserted hairspaces.  want em space flush or flush left of frame. for example below:

  • i want apply character styles em dashes based on strings in bold.
  • the strings of text trigger grep vary in number of words , may or may not contain dash.
  • i want ignore citynames regardless of number of words... chicago vs. san francisco vs. vancouver, bc example.
  • i want ignore monthofyear appears after second tab.
  • the tabs have set stops regular part of paragraph style.  i'm including them in example below in case helps visualize possible anchors use in grep.
  • i want style easy enough modify, example if want add (eeee new eventname) list of possible options within rule triggers specific character style.  see below should make clearer.

so here's i'm thinking...within paragraph style, first 2 examples of grep styles should able respond following criteria: rule 1:  if paragraph contains of following, apply char style 1 em dashes in paragraphs. use unique grep expression each phrase below each uses char style 1 or use single grep expression capture 3 possible triggers:

  • abc bb invitational
  • abc xxxxxxxxxxxxxx
  • abc mm-xxxxxxxxxxxxxxx

rule 2: if paragraph contains of following, apply char style 2 … , on

  • global abc xxxxxxxxxxxxxxx
  • global wxyz xxxxxxxxxxxxxxx

 

i cannot count on “abc” or “global” being trigger style, if know mean.  need entire phrase (abc bb invitational) trigger… if exist in entirety, apply style preceding em dash in paragraph.  way if there mispellings or if launch new event type ends flowing in document know it.

 

hairspace  emspace  tabspace citynameoneword abc bb invitational tabspace monthofyear

hairspace  emspace  tabspace  cityname twowrds abc bb invitational tabspace monthofyear

hairspace  emspace  tabspace  cityname multiwrds abc bb invitational tabspace monthofyear

hairspace  emspace  tabspace  cityname twowrds abc mm-xxxxxxxxxxxxxx tabspace monthofyear

hairspace  emspace  tabspace  cityname multiwrds abc xxxxxxxxxxxxxx tabspace monthofyear

hairspace  emspace  tabspace  cityname twowrds global abc xxxxxxxxxxxxxxx tabspace monthofyear

hairspace  emspace  tabspace  citynameoneword global wxyz xxxxxxxxxxxxxxx tabspace monthofyear

hairspace  emspace  tabspace  citynameoneword global special xxxxxxxxxxxxxxx tabspace monthofyear

hairspace emspace tabspace  citynameoneword globl special wrong spelling  tabspace monthofyear


i hope makes sense , isn't unnecessarily redundant.  time bed.  fingers crossed post @ least 1 grep string, have magic code tomorrow morning!  ideally, great if include brief explanation of waht string doing, minimally, please use 1 of text stings above, know mess , not to.  ;-)

 

<says prayer>

 

thanks!

rick

hi,

 

i think hairspace useless (in case of grep @ least).

if understood difference key :

tab_any_abc_any_tab

tab_any_global abc_any_tab

tab_any_global special abc_any_tab

etc

 

my suggestion:

in paragraph definition list of grep styles:

1.  style: 1charstyle

     condition: ~m(?=\t.+abc.+\t)

2.  style: 2charstyle

     condition: ~m(?=\t.+global abc.+\t)

3.  style: 3charstyle

     condition: ~m(?=\t.+global special abc.+\t)

....

and on many times many unique conditions have.

those 1 wrong spelling should stay untouched.

 

hopefully...



More discussions in InDesign Scripting


adobe

Comments

Popular posts from this blog

Warning, the Safe Path is not accessible vm3 - Joomla! Forum - community, help and support

uppercase letters in url - Joomla! Forum - community, help and support

Joomla! Update is not offering Joomla 3 - Joomla! Forum - community, help and support