1

Hi dear stackoverflow community,

I have a small GREP question and would need your help. In my catalog, there are some ordering numbers which need specific formatting.

As you can see, the numbers are always bold and they also are colored when they are preceded by a "to ". However, I want the two numbers before the " to" to be colored also. I was not able to find out how this is done. This is how they SHOULD look like using GREP. Basically the "00" is also colored.

How it should be

Right now, my GREP code looks like this.

(?<=\d\d)-\d\d(?=\sto)

On the right you can see that right now, the "00" in front of the "to" is not colored.

Does someone know why this is not working? :)

This is how my GREP window looks like at the moment

si1rin
  • 23
  • 5

1 Answers1

0

Apply the following three Grep patterns to the Paragraph Style:

  • (?<=[A-Z]{2}-)\d{4}-\d{2} - Apply Character Style: Bold (example).

  • (?<=[A-Z]{2}-\d{4}-)(\d{2})(?= to -??\d{2}) - Apply Character Style: Bold-Color (example).

  • (?<=[A-Z]{2}-\d{4}-\d{2} to )-??\d{2} - Apply Character Style: Bold-Color (example).

Note: The two different Character Styles used, namely Bold, and Bold-Color


Paragraph Style Options > GREP Style:

enter image description here

Result:

enter image description here

Community
  • 1
  • 1
RobC
  • 22,977
  • 20
  • 73
  • 80
  • Perfect, it is working! Thank you so much! :) I just have one question left, I sometimes have articles that look like this: AR-1234 Their numbers should also be bold. Is there a way to incorporate this into the code? I would try it myself, but frankly the code is too complex for me to understand :') – si1rin Apr 21 '20 at 12:00
  • Nevermind, I figured it out: used this code instead `(?<=[A-Z]{2}-)\d{4}-\d{2}|\d{4}` So thank you again, I think I learned a few things about GREP from you! – si1rin Apr 21 '20 at 12:07