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

Apply Bold to Date and Event Name using GREP

Tagged: 

Return to Member Forum

  • Author
    Posts
    • #66115
      Anonymous
      Inactive

      Hi

      I am still new at GREP Styles. I am able to create simple ones but I am stumped at how to address a combination of dates and event names. I am including three examples below. I do have Paragraph and Characters styles set up. The area I would like to effect the change is in all caps. I am trying to add a bold style only to the dates and the title of the event with out changing the rest of the information.

      I started of with this GREP Style:

      \d{1,2}\d{1,2}|\d\-?|\u

      It is bolding the dates and the name of the event. But it’s not bolding the small dash between events that have a beginning and end dates or the en dash. It is randomly bolding other numbers and capital letters that it should not. Very frustrating. Any ideas how to fix this?

      12/6-8 — HEALING WEEKEND AT TRUE NORTH HOLISTIC CENTER.  Friday  11am-5pm. Private Integrated Healing sessions, Friday 6:30pm-Sunday noon. “Blue Christmas” Retreat: Coping with Sadness at the Holidays; Sunday 3-7pm. Public Integrated Reiki™ clinic. Hubbardston, MA  http://www.truenorthholisticcenter.org. (978) 820-1139.

      12/6-12/8 — READ AND PLAY MUSIC IN A WEEKEND! World famous seminars turns beginners into musicians, revitalizes and inspires even pro musicians. 169 Mass Ave, Boston. (781) 599-1476 or https://signup.understandingofmusic.com or sallee@dlorien.com.

      12/7 — REIKI CERTIFICATION. Wilton, NH. Libby Barnett, MSW. 32 years experience. Reiki Energy Medicine author. Notebook, pin, certificate awarded. Credit cards accepted. CEU’s/contact hours. Call (603) 654-2787 or www.reikienergy.com. Reiki II: 12/8

    • #66119

      I have to admit, I don’t do much so far as GREP, but I’ve worked on lists such as these.

      Normally I nest the character style sheets.

      For the first one (the date), you can nest your character style through the em dash.

      The second nested character style could then be applied through the period and exclamation point (you can type both of those into the through field).

      I’m assuming that your paragraph style is the plain body text.

    • #66153
      Alvin Leu
      Member

      you could use this .. (you make need to replace the “~_” with indesign’s flyout em dash [pressing the @ thing] )

      ^.+(?=~_)

      Just make sure you use of Em dash is unique to the dates..

      • #66155
        Anonymous
        Inactive

        Thanks for the suggestion but ^.+(?=~_) only bolds the date at the beginning of each listing. I want to include the information that is in all caps as well. Someone suggested ^.+?[.!] by targeting the punctuations but not all of the listing will take advantage of that.

        Is there a way to tell it to pay attention to only words that are in all caps at the beginning of the listing and ignore words that are title case?

        Also, if I wanted to create a GREP style to seek out carriage returns, how would that be expressed? I tried \r but it will only work as search and replace function but not as a GREP style.

    • #66156
      Alvin Leu
      Member

      how about this ?

      ^.+~_(\u+)+(\u+.)

    • #66157
      Anonymous
      Inactive

      I tried that one, no changes were made. I came up with this one ^.+(\u+)+\u+

      it almost works, but the only problem is that if there happens to be a punctuation at the end of the last word that is all caps, no style is applied.

    • #66177
      Alvin Leu
      Member

      ^.+(\u+)+\u++\u+.

      like this ?

    • #66327

      Carlton Chin?

      Sorry I don’t have an answer for you but is this the Carlton Chin that used to work at Bernard Hodes in Boston by any chance?

    • #71997
      Anonymous
      Inactive

      Hey Dennis,

      It took me a while to figure where I saw your posting. (Unfortunately a year!) I rarely go back to this website other than to download the digital InDesign Magazine. I forgot I posted something in this forum. How’s it going?

    • #71998
      Allan Shearer
      Participant

      Hi Carlton

      This seems to work for me:

      .?(?!\u)

      Let me know if it works well for you.

      Yours,

      Allan

    • #71999
      Allan Shearer
      Participant

      Slight correction:

      .?(?!\u*+)

      So, How does this work?

      Well … rather than looking at what you’re trying to apply Bold to … look at what we’re NOT trying to apply Bold to! Huh!? :)

      The magic is in something called a “Negative Lookahead”. That part of the code is: (?!) [opens with (?! and closes with ) … and whatever is in-between is what you’re looking for]

      Thus, with this string: .?(?!\u*+) we’re saying:

      1. Look for “Any Character” “Zero or One” times: .?
      2. WHICH IS FOLLOWED BY “Zero or More” “Any Uppercase Letter”: \u*
      3. and “One or More” “Any Lowercase Letter”: +
      4. BUT, ONLY apply the Bold to whatever is found UP TO and NOT INCLUDING what is found inside the Negative Lookahead (?!)
      5. So … to accomplish No. 4 above, we wrap No. 2 and No. 3 inside No. 4 … and we get: (?!\u*+)
      6. Take No. 1 and No. 5 above and write them together: .?(?!\u*+)

      The Negative Lookahead is w-a-y cool. It allows you to ‘look ahead’ when searching for something with the intent of NOT (negative) applying whatever Character Style to this part that is found.

      Sounds VERY confusing, I know … but … it works. :)

      Hope this helps. :)

      Allan

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