Skip to main content
Participant
April 16, 2025
Answered

variable GREP styles based on amount of digits before the decimal.

  • April 16, 2025
  • 2 replies
  • 416 views

My mind is doing a 360 to even try to explain what I want to do, but I will try:
I am responsible for making a giant retail catalogue and prices range from 0.⁰⁰ to 0000.⁰⁰

 

I wish to automate a rule with GREP where it will automatically fill in the decimal after x or y amount of digits.

 

I want to be able to automatically fill in the decimal after 1 or 4 digits, based on the data.

 

so if the price is 34.29. I want GREP styling to see that this spefific speficially has 2 main digits ( 34 ) and should then jump to decimal and fill it (29 ).

 

for a longer price, lets say 2432.28, I want GREP to notice the 4 main digits and then jump to decimals.

In short, I am trying to make GREP style see the difference in main digits and decimals and decide what to do accordingly.

is this possible at all?

 

thank you very much!

 

Correct answer jmlevy

If I understand well, you need this?

This GREP style should work

If the prices are the only text on the text frame and if there are only one price in a frame, a single nested style will work.

2 replies

Scott Falkner
Community Expert
Community Expert
April 22, 2025

That is an odd format. Superscipting the pennies usually doesn’t need a decimal. The prices look better without. GREP Style could apply a format to make the decimal effectively invisible. Make the szie 0.1 pt and horizontal scaling 1%, then fill with none.

 

I used the Numerator form of Myriad for the cents, not superscript. This puts the top of the cents in line with the dollars. The decimal is still there (it needs to be for the cents formatting to work).

 

Participant
April 22, 2025

thanks a lot! It's a shame but te customer requires a decimal point. I dont have a say.

jmlevy
Community Expert
jmlevyCommunity ExpertCorrect answer
Community Expert
April 16, 2025

If I understand well, you need this?

This GREP style should work

If the prices are the only text on the text frame and if there are only one price in a frame, a single nested style will work.

Participant
April 22, 2025

thank you! This helped me out a lot!