Skip to main content
Participant
August 1, 2023
Question

GREP Code applying superscript only to 1 or 2 letters

  • August 1, 2023
  • 1 reply
  • 336 views

Hello,

 

I hope someone can help me with the following.

 

I am looking for a GREP Code in which it is possible to achieve this:
“no. 123” to “no 123” and “nos. 123” to “nos 123”

 

Just to clarify, in the letters “no” and “nos”, only the “o” and “os” may be converted to (open-type) superscript. And the dot has to be deleted and and the subsequent numbers should be retained.

 

Thank you very much.

 

Kind regards,
Dylan

This topic has been closed for replies.

1 reply

Mike Witherell
Community Expert
Community Expert
August 1, 2023

Find what:

(n)(o|os)\.

Change to:

N$2

This would result in no and nos as No and Nos and would delete the dot at the end

 

Next:

Find what:

(?<=N)((o)|(os))(?= \s)

Change to:

$2

Change Format:

Superscript

Mike Witherell
Participant
August 1, 2023

Hello,

 

Thank you for your reply. But in this case it changes the letter 'n' also to superscript, while it should remain undercast.

How can this code be adjusted?

 

Thank you very much.

 

All best,

Dylan

Mike Witherell
Community Expert
Community Expert
August 1, 2023

It worked correctly for me.

Mike Witherell