Skip to main content
Patrick Bruggink
Known Participant
September 4, 2023
Question

Grep style prices

  • September 4, 2023
  • 1 reply
  • 266 views

I have 2 kinds of sums. 20.95 and 20.-.
If the last 2 characters is an amount it should be superscripted. If it is .- it should not be changed. Can anyone help me with a grep style?

This topic has been closed for replies.

1 reply

Patrick Bruggink
Known Participant
September 4, 2023

Peter Spier
Community Expert
Community Expert
September 4, 2023

Actually, I don't think a GREP style is what you want here.

I say this because GREP styles (or any style) cannot add or remove text, ony change formatting, and I beleive you need to remove the . in the price as well as apply superscript to the two digits after it. I say this based on what is conventional in US, and if you are in another locale the rules might be different.

If my premise is correct, you should be using Find/Change.

Find (\d+\K)(\.)(\d{2}) and change to $3, adding the superscript formatting in the change format settings.