Skip to main content
Participant
October 20, 2025
Answered

Grep query

  • October 20, 2025
  • 1 reply
  • 281 views

Hello. I apologize for my English im from Russia! I wanted to ask how I can write a regular expression in InDesign that will find values ​​like 14th and change the th to superscript mode.

I did 

Find

(\d+)(th)

Replace to

$1–$2

 

and I added a superscript at the bottom, but it didn't work. The number itself changed, but I only needed to change the letters.

Correct answer Eugene Tyson

Are you sure you're in the GREP tab of the find change dialog

 

Another way to write it is
\d+\Kth\b

And in the change format 
Set superscript ----> or even better - use a character style.

1 reply

Mike Witherell
Community Expert
Community Expert
October 20, 2025

Find:

(?<=\d+)th

Change format:

apply Superscript

Mike Witherell
Participant
October 21, 2025

Hi, Thanks for your reply! When I type this,

(?<=\d+)th

it says "No match found"

Eugene TysonCommunity ExpertCorrect answer
Community Expert
October 21, 2025

Are you sure you're in the GREP tab of the find change dialog

 

Another way to write it is
\d+\Kth\b

And in the change format 
Set superscript ----> or even better - use a character style.