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

GREP styles and soft returns

Return to Member Forum

  • Author
    Posts
    • #58686
      Anonymous
      Inactive

      Hi everyone,

      I've used the following code in an Indesign GREP style:

      ^w+ w+ FTIA|^w+ w+ ATIA|^w+ w+

      This code applies a character style to the first three words in a paragraph based on the following 3 conditions:

      1) It looks for the first two words plus some specific letters, FTIA

      2) It looks for the first two words plus some specific letters, ATIA

      3) It looks for the first two words only

      If any of these conditions are fulfilled then the specific words and/or letters have the character style applied. This all works well but there is a slight glitch. If I apply a soft return to the paragraph, ie. in order to force a word to the next line, the GREP style gets applied again to the specific words on this next line. I always thought GREP styles were applied on a paragraph by paragraph basis so I'm not sure why this is happening with a soft return.

      I wondered if any knows of a workaround to prevent this?

      Really appreciate any assistance.


    • #58687

      .. there is a slight glitch. If I apply a soft return to the paragraph ..

      Yep — noticed this before. It seems a soft return is also picked up by “^” as a new line. Well … technically it is a forced new line, of course. The odd thing is that GREP sees it as a new paragraph, whereas InDesign treats all as a single paragraph, and always has done so. Perhaps it's a mere oversight by the programmers when they added GREP.

      If I apply a soft return to the paragraph, ie. in order to force a word to the next line ..

      Avoid that. Use non-breaking spaces (there is a default shortcut for that) or No Break (no shortcut by default, but since it's so useful I added one to my own KB set).

    • #58689
      Anonymous
      Inactive

      Thanks for the information

    • #60123

      Have some time and read some old posts ;-)

      For me, this one works:

      (?<!n)^w+ w+( FTIA| ATIA)?

    • #78437
      Gavin Anderson
      Participant

      This works great for GREP which is intended to apply to words at the start of the sentence, but I am working on one which is intended to apply to all the words between braces (\{) and I am finding that it gets broken by the soft return. Unfortunately Jong’s solution doesn’t help here, because I don’t have control over how the customer service team decides to wrap the text.

      Here’s an example paragraph:
      Enjoy our {description; i.e., indoor/outdoor/infinity} pool, located on {location within hotel}. Pool towels, umbrellas and chaise lounge [soft return]
      services are available daily, beginning at {time}. {Insert optional text about pool-side or [soft return]
      beach-side cuisine and beverages are [soft return]
      available during specific hours.}

      The object is to get the code to apply a character color to everything between braces, but only between braces. So, normally, I would just put:

      \{.+?\}

      But that is getting broken by the soft returns.

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