Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Word Delimiters in GREP styles

Return to Member Forum

  • Author
    Posts
    • #62587
      Jennifer Flores
      Participant

      This seems like it should be ridiculously easy but I've been having trouble trying to solve this for some time. I'm hoping to create a GREP style that applies a character style to all characters up to either of these words “is” or “are” but not to include those words in that formatting. Nested styles haven't helped me for some reason.

      So far I've had some luck with ^(.+is), followed by a consecutive grep style of ^(.+are), but naturally, these are including my delimiter words.

      I'm not overly concerned with greedy vs short strings because these are one line sentences and probably won't have a 2nd occurence of my delimiter words. Any help, advice, tips, recommendations or links are welcome!

    • #62589

      .. either of these words “is” or “are” but not to include those words in that formatting ..

      Exactly there is where a little Looking Ahead can help you! A Lookahead is a text string that will be found but not included in the match itself, and it looks like this: any(?= text). This will find “any text” but only match the phrase before the lookahead: the word “any”. If you use this in a Find command, you will see only the word “any” will be selected, and if you use it in a GREP style, your character style will only be applied to this.

      Try this:

      ^.+(?= (is|are))

      — note the single space inside the Lookahead, so it won't match “this” (or “thare”, for that matter).

    • #62591
      Jennifer Flores
      Participant

      I really appreciate the explanation, you make it seem so easy. Trying to understand GREP over the last year has been like like having my brains smashed out by a slice of lemon wrapped around a large gold brick.

      Teus, you’re a godsend. I can’t tell you much your posts/scripts/hacks/ and tips have helped me over the years, since CS2.

      You are appreciated!

    • #64546
      questin
      Member

      I don't undersand very well how this delimiters work…

      My example is a list of authors with their biography:

      “familyname, name; familyname, name. texttexttext…

      familyname, name. texttexttext…”

      I wanted to apply a character style just to the family names and I did those grep styles:

      ^[lu]+,

      and

      ; [lu]+,

      but the style applyed (obviously) to comas as well, and i just want the family name to be un such a style.

      I tried with the Lookahead, but I don't manage to make it work…

      Coul somebody help me?

      Thanks in advance!

Viewing 3 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads