GREP help requested

Learn / Forums / General InDesign Topics / GREP help requested

Tagged: 

Viewing 3 reply threads
  • Author
    Posts
    • #80127
      Todd
      Member

      I’m starting to learn GREP styles and have a problem with one I can’t figure out. On the first line of a copy block, I have a price followed by a space followed by a descriptor (like SALE, EACH, etc.) that could be one or more words and could include punctuation. After the first line, there is more copy for the product description, etc., but none of this requires a GREP style; only the price line does. There are five character styles to be applied within the price line: DOLLAR SIGN (to superscript the dollar sign at the start of the price), DISAPPEAR (to make the decimal point seemingly vanish), DECIMALS (to reduce the point size and baseline shift the decimals of the price), BUFFER SPACE (to track the space after the price to tuck the descriptor under the superscripted decimals of the price), and DESCRIPTOR.

      My problem is with the GREP style for the descriptor. I need all the characters in the descriptor (including spaces and punctuation) AFTER the buffer space to use the DESCRIPTOR character style. I can get the words to work by using \u|\l, but then the punctuation is unchanged. Using \w or . messes up the other character styles.

      Here are my GREP styles for the other character styles:
      DOLLAR SIGN: \$
      DISAPPEAR: \.
      DECIMALS: (?<=\.)\d{1,2}
      BUFFER SPACE: (?<=\d)\s

      Any and all help is greatly appreciated. Thanks in advance.

    • #80134
      Peter Kahrel
      Participant

      I think the problem is the order in which you apply the GREP styles. Start with the descriptor, applying your style to .+$
      Then do the other parts. The effect is that the descriptor style is applied to the whole paragraph, then the dollar sign, disappear, etc. styles override the descriptor at the beginning of the paragraph.

      Peter

    • #80167
      Todd
      Member

      Peter, thank you very much for your help. I moved the DESCRIPTOR style to the top of the GREP styles, tweaked the DESCRIPTOR code a little (to include punctuation and spaces), and now everything works perfectly. Thanks again! :D

    • #80231
      Chris Court
      Member

      Fan of inDesign GREP that I am, this seems to me to be an ideal use-case for nested styles. Am I missing something?

      C

Viewing 3 reply threads
  • You must be logged in to reply to this topic.
>
Notice: We use cookies on our websites to give you a great online experience. If you keep browsing, we'll assume you're ok with this. For more information, see our privacy policy. By closing this banner, you agree to the use of cookies.I AGREENo