1 Reply Latest reply on Jun 28, 2016 12:51 AM by Peter Spier

    Grep: select and add style on part of selection




      I generate some certificates with Indesign by "data merge".

      I'd like to add superscript to the "th" of the dates. Dates are in following format: June, 16th

      - Step 1: I search the dates: Grep: \d{2}th

      - Step 2: I'd like to add a Caracter style, but only on the "th" and not the numbers.


      So is it possible to add a style only on a part of the selection? Or is their any other technique to add subscript on a date?


      Thanks for your help!!  :-)

        • 1. Re: Grep: select and add style on part of selection
          Peter Spier Most Valuable Participant (Moderator)

          Try (?<=\d)th


          This is a positive look-behind and finds th preceded by any digit, so it will match number strings of any length. I'm not sure why you wanted to limit it to 2 digits, but you can do that if you like by using the {2} in the look-behind.


          What about the other ordinals, st, rd and nd? Same technique...


          I would add these as four GREP Styles to your paragraph style.