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

Make everything bold before (and included) a colon using GREP?

Return to Member Forum

  • Author
    Posts
    • #64461
      Anagoge
      Participant

      I want a GREP style to find and replace all instances in a directory so that it goes from this:

      Address:123, Somewhere, Etc

      Phone: 123-456-789

      Website: https://www.somewhere.com

      To this:

      Address:123, Somewhere, Etc

      Phone: 123-456-789

      Website: https://www.somewhere.com

      I already have a Character Style set up (“Bold”). Any help would be very much appreciated please.

    • #64462

      Easy. Use this:

      ^.+?:

      It comes down to this:

      ^ from the start of a paragraph ..

      . match any character ..

      + .. as much as possible ..

      ? .. and then the shortest match ..

      : .. up to a colon.

      The '?' is necessary here because without it, the '+' would match as much as possible, all the way up to the very last colon in a single paragraph.

    • #88364
      Anonymous
      Inactive

      This is fantastic help. Add’l question though, what if I want everything before the colon, but NOT the colon to be bold

    • #88368

      Everything from start included the colon:

      ^[^:]+:

      Everything from start excluded the colon:

      ^[^:]+

      The GREP find the beginning of a paragraph, followed by anything, that is not a colon, one or multiple times, followed by a colon (first case) or not (second case)

      Kai

    • #88561
      Nancy Tejo
      Member

      How do I make a list of items bold before the word “In” for example
      Joe and Judy Smith In Honor of the birth of a baby I want the words Joe and Judy bold. Everything before the word In. I have a large list of items, hundred just like this.

      Some need to be bold before the word Speedy:
      Carol and John Glenn Speedy recovery to Ann smith

      Thanks for your help.

    • #88562

      Nancy, it is easy to ask something, and type the answer in the find/change field. But your goal should be to understand what you did.

      In your first case, you search for the beginning of a paragraph, followed by something, till you reach the position on the first In.
      So maybe: ^.+?(?=In) will work.

      But this will help you only with your first task.

      If you have a large list of items, this is maybe possible or maybe not. This depends on your text.

      However: In the last years, it seems normal, that someone ask for a script, and someone write it for you. Today it is clear, that there are to many free scrips available … so you will not get a complete solution (from me)

      Kai

    • #14323195
      Ben Harris
      Member

      This is the better solution since you can use a soft return within the style and it still works.

    • #14323194
      Nathan Rule
      Participant

      Why not just use a Nested Style? You can choose a character style you’ve created and tell it to apply up to the 1st “in”

    • #14330843
      Flavio Mini
      Participant

      super advice.
      I am trying to make the following using Grep
      I have created a Figure number style using bullets and numbering
      now i would like to make the beginning of the the caption upto the first period Bold
      I have created a character style “Bold”
      I also formatted a Left Indent of 1″
      and a First Line Indent of -1″

      how can i make by using Grep just Figure 1-1. Bold?

      Thank you for your help

    • #14331689

      @ David Blatner: Done? …

      (^/) The Jedi

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