Help me with GREP

Learn / Forums / InDesign User Groups / Help me with GREP

Viewing 9 reply threads
  • Author
    Posts
    • #83652

      Hi Im trying to figure out how to locate an exact set of letters and stylize just that grouping.

      I need to find LLNYC wherever it appears and apply my Italic Character style that Ive set up.

      BUT I dont want it to apply that style when LLNYC.com appears

      JUST when it appears on its own.

      Thanks
      G

    • #83656
      Ari Singer
      Member

      Very simple, done with a negative lookahead.

      LLNYC(?!.com)

      Please keep me updated.

    • #83659

      ahh the wonder of help via the interweb! lol thank u so much Ari

      i literally was struggling half the day trying to figure this one out

      Works Perfectly

      G

    • #83660
      Ari Singer
      Member

      My pleasure!

      You probably could’ve done it simpler as well. As I believe that LLNYC is a name that is always by itself with spaces on both sides (except in a URL of course, where it’s followed by .com), then you can just write this: LLNYC (notice the space after the C). So whenever it encounters something else than a space following the C it won’t pick it up.

    • #86537

      unless it just happened to come at the end of a sentence …LLNYC. Or if it was in the possessive: “LLNYC’s president said…” in which case Ari’s GREP solution would be the best :)

    • #90768
      James Nimmo
      Member

      Can somebody please help me with a bit of GREP I cannot figure out?

      I am a complete novice so please be patient with me.

      I am putting together a programme for 2017 for my local sailing club. Within the programme are various events. For example, I would like all the training events to be coloured green. All the courses start with “RYA” and end in either a return or a tab.
      For example on March 12th (Sunday and 12 are black. I want the rest green)
      Sunday{tab} 12{tab} RYA Short Range Certificate (VHF) Exam{tab} RYA Powerboat Level 2 Course{end of para}

      My nearest thing to success has been the first 2 words appearing in green using “RYA \w*”

      I would also like every social event which contains “Lunch or Dinner or Supper…etc” to be red. Again up to either a tab or end of para.

      I have managed to get all events which containing “Committee Meeting (time)” to be grey using “\w+ Committee Meeting \(.+?\)” but that is my only success.

      Can anyone please help me?

      • #90772
        David Blatner
        Keymaster

        Looks like you need to learn about wildcards! :-)
        RYA.+?\t means “RYA followed by a string of any characters up to a tab.”

    • #90774
      James Nimmo
      Member

      Yes, I do indeed need to learn a great deal about GREPs in general. Can you recommend any good books or websites?

      Thank you so much David.

      Any hints on the social events which contain “Lunch or Dinner or Supper…etc”?
      They might have something before Dinner etc like “Dinghy Class Dinner” and/or after like “London” or “(Joe’s Café)”

      Many thanks again.

      • #90775
        David Blatner
        Keymaster

        We have many articles and more about GREP here: https://creativepro.com/grep
        If you search for GREP on our site, you’ll find even more. :-)
        You’ll want to look for things like “positive lookahead” and “positive lookbehind”

    • #90786
      James Nimmo
      Member

      Thanks David.

      I am struggling.

      Amongst the things I have tried is
      (?<=)Lunch|Dinner|Supper|Drinks|Party(?=)

      You won’t be surprised that my efforts don’t work – I have clearly misunderstood the instructions.

      Any suggestions?

    • #90787
      David Blatner
      Keymaster

      A different thought: if each of these lines is set up in a similar way (with tabs separating each section), then you should consider one of two different options, which don’t involve GREP:

      • You could just select the paragraphs and convert them into a table. The rule is: If you’re making something that looks kind of like a table, and smells like a table, then it probably should be a table! :-)
      • You could use nested styles… just make character styles, and then apply them using nested styles rules to each section using the “up to” tab rule. Here’s a silly example of nested styles, but it gives the basic idea: https://creativepro.com/holiday-text-fx-part-3-fun-with-nested-styles.php
    • #90788
      James Nimmo
      Member

      Many thanks David.

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