GREP paragraph style question

Learn / Forums / InDesign User Groups / GREP paragraph style question

Viewing 6 reply threads
  • Author
    Posts
    • #116253

      Hi Grep gurus… I am trying to make a GREP rule in my paragraph style “Babies”.

      I want to apply an existing Character style to part of the 3rd paragraph IF the text matches my GREP in the previous 2 paragraphs.

      The format I receive from the authors is in the following format:
      BOY
      Photos: 1844-48
      Jimmy Bob O’CONNOR
      …etc

      Another different GREP rule will also exist to apply a different style for “GIRL”.

      So, the character style “Babies – BOY” will be applied to the name (which bolds and colours it cyan).

      That means “BOY” or “GIRL” is important, the next line is not so important, it’s just the Photo reference, then the third paragraph is the important one that needs stylising.

      Thanks folks!

    • #116255
      David Blatner
      Keymaster

      I don’t think you can apply a grep style that acts across multiple paragraphs. The GREP style is really focused on patterns within a single paragraph.

      However, you could use the GREP tab in the Find/Change dialog box to apply it. For example, you could search for GIRL\r.+\r\K. and apply a paragraph style to it, like this:

      This searches for the first character of a paragraph that is 2 paragraphs down from the word “girl” and applies the paragraph style to the whole paragraph.

    • #116282

      Thanks for your reply David!

      I’m surprised that’s not a feature (yet!). I can imagine a myriad of uses for using a GREP rule in a paragraph style that reacts to multiple paragraphs inside the story (think, Table of Contents, Top 10 list, Q&A and more).

      I hope Adobe can add that to the feature list!

      So I guess the next question is, can your Find/Replace solution be coded into a script? That might be a working option! No idea where to start on that though. Can you suggest a forum or resource for figuring out how to do it?

      Thanks heaps!

    • #116284
      David Blatner
      Keymaster

      You can probably turn this into a script using the FindChangeByList script. See:
      https://creativepro.com/tag/findchangebylist

    • #116855
      Jeremy Howard
      Participant

      I know I am late to the game on this one but my ears always perk up at the mention of GREP…

      Brett, have you considered using line breaks (AKA soft returns)? You can get the results that you are looking for using soft returns rather than paragraph returns with this GREP string:

      GIRL\n(.+\n)+\K.+(?=$)

      BONUS: This will work with a minimum of 3 lines (separated by soft returns) and there is no maximum number of lines!

      See my screenshot for an example:

      GREP – Girl/Boy paragraph with soft returns

      On a different note, David, How do you post images on these threads?

    • #116856
      Jeremy Howard
      Participant

      It seems that I answered my own question! The image embedded by simply placing the url in the comment… Cool!

    • #14407899
      Margherita
      Member

      Hi!

      I am trying to understand how to apply the same character style to many different paragraph styles

      problem: I need to use a bold style on names on body copy, table text, dida exc

      I am using the GREP style to insert the list of names divided by a pipeline and the character styles applied to it but this means repeating this on each paragraph style…

      I tried to apply the character styles with the list of names on a single paragraph syle named GREP and this is going to be the mother of all the other paragraph, but this is not working…

Viewing 6 reply threads
  • You must be logged in to reply to this topic.
>