Copy link to clipboard
Copied
Hi InDesign community,
I have a catalog with product numbers and there are a lot of numbers/letters that need to be formatted in color when they appear behind each other.
However they should not be formatted when there is only one instance and afterwards there's a line break.
Right now I am using this code, but it does not catch the letters and the one-instance numbers are also formatted which they should not.
(?<=-|\.|\s)\d{2}(?!\d)
This is how my file looks like with the above code:
(pink line just added for emphasis that this is the wrong appearance)
And this is how it SHOULD look like:
I imagine I need to find some way to check if there are multiple instances in one line. There is always a break after each line. But I am unsure on how to do it. Can you help me?
Copy link to clipboard
Copied
This could probably not be done with one simple regex... Maybe multiple one like here...
Copy link to clipboard
Copied
Hi Jean-Claude,
that's amazing, thank you!
I looked at your code in detail and learned a lot about GREP just by informing myself about all the different expressions that you used.
The code works well, there is just one minor bug I see.
In the first line, the code also catches the "VA" from "VAR", which should be left alone.
I wonder how to fix that, I suppose we need to tell the GREP to stay away from longer words?
Copy link to clipboard
Copied
Or you can target them and style them black again.
Does the first 00 in VAR-0000-00, VAR-0000-00 need to be blue?
Copy link to clipboard
Copied
Does the first 00 in VAR-0000-00, VAR-0000-00 need to be blue?
By @Jean-Claude Tremblay
Hi Jean-Claude,
no, it should not be blue. It's a bit complicated, unfortunately, but in this case there are two separate product numbers and thus tbey should not be fomatted.
The numbers in the lines below all have different options and this is why these options need to be highlighted with a color.
Copy link to clipboard
Copied
Maybe this...
Copy link to clipboard
Copied
Hi @mira_00
please read your older thread again carefully. With all the questions about concrete rules and exceptions and the requests for example texts. Otherwise, this thread will also fizzle out and quietly end without any real solution.