Skip to main content
Participant
Oct 20, 2025 1:59 PM UTC
Answered

Grep query

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.

Eugene TysonCorrect answer
Community Expert
Oct 21, 2025 11:56 AM UTC

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.

5 replies

Mike Witherell
Community Expert
Community Expert
Oct 20, 2025 2:18 PM UTC

Find:

(?<=\d+)th

Change format:

apply Superscript

Translate
Mike Witherell
Participant
Oct 21, 2025 8:54 AM UTC

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

(?<=\d+)th

it says "No match found"

Translate
Eugene TysonCommunity ExpertCorrect answer
Community Expert
Oct 21, 2025 11:56 AM UTC

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.

Translate