Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
2

Grep style prices

Community Beginner ,
Sep 04, 2023 Sep 04, 2023

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?

TOPICS
SDK
248
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 04, 2023 Sep 04, 2023

Screenshot 2023-09-04 at 11.23.16.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 04, 2023 Sep 04, 2023
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines