Skip to main content
Participant
June 8, 2022
Answered

GREP and or Script Help for applying style to only range of number and %

  • June 8, 2022
  • 1 reply
  • 344 views

I want to be able to apply my paragraph style to a range of numbers. BUT, I also want to apply it to the % sign that is associated with ONLY the numbers in that range. For instance I want anthing that is less than or equal to 25% to use my pargraph style. I was able to use a GREP that worked for the number range but I need the percent sign to only be the style when it fits in that range. Is this possible?

 

I also would ideally like to be able to use this in a data merge document. Is there a script for this?

This topic has been closed for replies.
Correct answer jctremblay

To be able to apply it automatically when using Datamerge you will need to use a GREP Style in your main paragraph style that will apply a character style to number from 0% to 25%.

You can do this using:

\b(\d|1\d|2[1-5])\b\h?%

 

1 reply

jctremblay
Community Expert
jctremblayCommunity ExpertCorrect answer
Community Expert
June 8, 2022

To be able to apply it automatically when using Datamerge you will need to use a GREP Style in your main paragraph style that will apply a character style to number from 0% to 25%.

You can do this using:

\b(\d|1\d|2[1-5])\b\h?%

 

Participant
June 8, 2022

Thank you!!