grep search expression

Home Forums General InDesign Topics grep search expression


This topic contains 5 replies, has 4 voices, and was last updated by  Anonymous 1 year, 8 months ago.

  • Author
  • #67371


    HI all

    Anyone out there know the quick GREP search terms for finding an apostrophe followed by a space then an uppercase letter?

  • #67375


    By jiggitty, give it up to the GREP newbie. I think I figured it out:


    This came in handy:

    .’\s\u apparently searches for any punctuation followed by an apostrophe followed by a space then an uppercase letter. It is finding instances where this happens between paragraphs, but I don’t mind.

  • #67446

    Hi All,
    I’m trying to write a grep to convert improperly styled times on a calendar to the proper style.
    I want the grep to find “am.” and change it to “a.m.”
    But since there is the possibility of having an “am.” being part of a show title such as “Sam I am.” I wanted to use a look behind to exclude an “am.” that is preceded by an “I” and a blank space.

    The negative lookbehind grep I was writing looks like this:

    I also tried a positive lookbehind for an am. preceded by a space and a digit to narrow the types of am.s that could be selected

    The first one still selects the “am.” following the “I” and the space.
    The second selects nothing.
    Any ideas on how to use a lookbehind to select only the “am.” following a digit and a space?

    • #67516

      Steve Jenks

      Hi Milt

      I think it could be as simple as ignoring the look behinds and simply searching for any occurrence of a digit followed by a space followed by ‘am.’

      If this is the case then if you searched
      (\d )(am.)

      and replaced with

      It should change just the times and leave the rest alone.


  • #67520

    Thanks for the reply, Steve.

    This is what I ended up writing that worked:

    (?<=\d)am\.|(?<=\d/s)am\.|(?<=\d)am(?=\,)|(?<=\d/s)am(?=\,)|(?<=\d)am(?=\-)|(?<=\d/s)am(?=\-)|(?<=\d)am(?= *)|(?<=\d\s)am(?= *)|(?<=\d)am(?=\;)|(?<=\d\s)am(?=\;)

    then replace with “a.m.”

    It picks up every variation of the incorrect “am”s

    • #67536


      Glad you got it sorted Milt.

You must be logged in to reply to this topic.