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 locate second comma in a paragraph

Return to Member Forum

  • Author
    Posts
    • #101242

      Massive list of names (2K+) followed by addresses, etc. Each block of name info is its own paragraph. I need to locate the second comma from the beginning and make it bold. The second comma will always be after the first name.

      Names are ^last[comma1] first MI[comma2] (if there is a MI)

      I need to locate ROMAN comma 2 and make it BOLD.

      Thanks for any assistance!
      JR

    • #101247
      Graham Park
      Member

      This is not elegant but should work for you
      Add these GREP to your paragraph style
      The first one will make all the text bold up to the second comma, the second will then over ride the first style to make the text roman. They have to be in this order to work.

      Style – BOLD
      ^[\u]+,[\u]+,

      Style – NORMAL
      ^[\u]+,[\u]+

    • #101248
      Vinny –
      Member

      What about using 2 nested styles?
      Apply [none] up to 2 commas
      Apply Bold through 1 comma

    • #101250
      Graham Park
      Member

      That is a better solution

    • #101251

      Vinny,

      A simple Grep style seems to me always more relevant! but it’s a personal view! …

      (?s)^.*?,.*?\K,

      (^/)

    • #101252
      Vinny –
      Member

      @Obi
      Okay but… why?

    • #101262
      Graham Park
      Member

      (?s) Single Line ON
      ^ Start of paragraph
      .*? FInd any character Zero ore more times Shortest match
      , Followed by a comma
      .*? FInd any character Zero ore more times Shortest match
      \K Positive Look-behind
      , This is what the positive look behind is matching if the above conditions are met.

      \K allows for the use of the wildcards that the normal positive look behind does not.

      Very nice Obi-wan

    • #101263

      Teacher Park! Thanks for the technical exegesis! [I appreciate!]

      (^/)

      [I however consider (?s) here as an aberration, but it a personal point of view!]

    • #101265
      David Blatner
      Keymaster

      Personally, I would use Nested Styles instead of GREP Styles for something simple. But both are good. :-)

      But it sounds like John wanted to use Find/Change to do this. So in that case, GREP is the way to go.

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