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 Look ahead and look behind queries

Return to Member Forum

  • Author
    Posts
    • #101343
      Anonymous
      Inactive

      Hi I hope someone can help. I am trying to make two GREPS to style a menu. I want one to style the food name and another to style the food description. An example is below.

      Food Title (RIGHT ALIGN TAB) £XX.XX (SOFT RETURN HERE)
      Food description. (END OF PARAGRAPH)

      with this in mind I figure the below should work.

      for the Food title = (?=~y)[\u]*
      I thought this should look ahead for any right align tabs and then style any text behind it.
      ~y = (right align tab)

      in addition for the food description i though it should be the below.
      (?<=£\d+\.?(\d+)*)[\u]* OR
      (?<=^n)[\u]*
      a positive look behind for either the variable price formats or a soft return followed by setting it to edit the words that follow this. I am fairly new so still trying to get my head around GREPS, but any advice you guys can offer would be greatly appreciated.

    • #101346

      Glen, I think that you can keep it simpler without having much to do with lookahead and lookbehind for your situation.

      I suggest two simple GREP style, see the screenshot:
      https://adobe.ly/2nuBRDw

      Let me know if it works for you

    • #101349
      Vinny –
      Member

      In my honest opinion, nested styles are much likely to be your friends here than Grep styles.
      A simple nested style “to ^y” (right-align tab) will nicely format your food title.
      About food description, why not simply create a new paragraph instead of using forced-line break?
      In case you must/want to keep your forced-line break, use another nested style “to Forced-line break” to format your price.

      By the way, why should the characters of Food title be either \u, or space? What about Hot-dogs? ^^

    • #101350

      I agree with Vinny 38, nested styles is enough for this, but I prefer the forced-line break method rather then creating two paragraphs styles so I agree with Glen on this.

    • #101353
      Anonymous
      Inactive

      Hey Guys,

      Just wanted to say a massive thank you for the advice. Got caught up with another project since posting, will follow this up tomorrow and let you know how I got on! In all honesty I haven’t used nested styles in the past but will be interested at looking at the different benefits of the two and when they should be used. Have a good evening :)

    • #101354
      Anonymous
      Inactive

      PS – Vinny cheers for the Hot-Dogs (food for thought)

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