Copy link to clipboard
Copied
Hi,
I would like to add colours to alternative numbers so that it is easy to read like this:
12 (13, 14, 15, 16, 17, 18)
Brackets needs to be where it is placed.
Does anyone one know how I can use GREP so that it is applied to the document? I find GREP so hard to understand!
Many thanks for your help.
Just For Comment:
Supposing someone only wants to colorize numbers between parenthesis! … [first, third, fifth, seventh, …]
In this case, alas, Eugene's Grep code gives us an error on each text line!
Personally, I've never thought trying to write an "magical" unique Grep code is the fastest and best way to play!!
But write a simple Grep code we can duplicate is a way I often use, faster and simpler to play, with more control too! 😉
Here:
Grep Style 1: \((\d+,\h){0}\K\d+(?=.*\))
Grep Style 2:
...Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi!
Please could you teach me how to do both?
Global means to add GREP in the character style right? Yes I would like to know that as well as Find&Change. Are the code the same?
Thank you so much!
Copy link to clipboard
Copied
copy this GREP
(?!\()\d+(\d+[\(\),\[\] ]*)\K\d+
Create a character style for the Red Text
In the Paragraph Styles go to the GREP Style section
Insert the code
and select your Red character style.
Copy link to clipboard
Copied
Just For Comment:
Supposing someone only wants to colorize numbers between parenthesis! … [first, third, fifth, seventh, …]
In this case, alas, Eugene's Grep code gives us an error on each text line!
Personally, I've never thought trying to write an "magical" unique Grep code is the fastest and best way to play!!
But write a simple Grep code we can duplicate is a way I often use, faster and simpler to play, with more control too! 😉
Here:
Grep Style 1: \((\d+,\h){0}\K\d+(?=.*\))
Grep Style 2: \((\d+,\h){2}\K\d+(?=.*\))
Grep Style 3: \((\d+,\h){4}\K\d+(?=.*\))
Grep Style 4: \((\d+,\h){6}\K\d+(?=.*\))
Grep Style 5: \((\d+,\h){8}\K\d+(?=.*\))
…
The numbers in pink gives us the number place between parenthesis.
To get the second, fourth, sixth, eighth, tenth number, just change:
0 => 1, 2 => 3, 4 => 5, 6 => 7, 8 => 9.
(^/) The Jedi
Copy link to clipboard
Copied
Great, thanks for sharing!
Actually not sure why the 100 is not being picked up by my GREP, it works on the Mac, but not on Windows, very strange behaviour, as it does work... maybe too complex.
Beacause \d+ should pick up all the digits but it doesn't on Windows...
Anyway - a way to do it too.
Must remember this trick, of course I didn't test multiple GREPs.
It was challenging to come up with 1 GREP - which fits the scenario.
But not additional scenarios that were not present and didn't test - which is fine.
Turns out InDesign GREP is just too greedy and multiple grep approach seems to work smoother.
Copy link to clipboard
Copied
Thank you FRIdNGE! I wouln't have been able to figure any of these out!
Tried and it works but except for the number with the decimal place (I have numbers up to 1d.p.).
Please could you tell me how I can add this?
Copy link to clipboard
Copied
Grep Style 1: \(([\d.]+,\h){0}\K[\d.]+(?=.*\))
Grep Style 2: \(([\d.]+,\h){2}\K[\d.]+(?=.*\))
Grep Style 3: \(([\d.]+,\h){4}\K[\d.]+(?=.*\))
Grep Style 4: \(([\d.]+,\h){6}\K[\d.]+(?=.*\))
Grep Style 5: \(([\d.]+,\h){8}\K[\d.]+(?=.*\))
…
(^/)
Copy link to clipboard
Copied
Reading your screenshot, light version [ at your own risk! =D ]:
(\(|[\d.]+,\h)\K[\d.]+(?=.*\))
(^/)
Copy link to clipboard
Copied
Thank you very much! Very helpful 😄
Copy link to clipboard
Copied
Working superbly well so far until I had a set of numbers AND a hyphen (-). How will I include to change numbers when it is numbers and -?
Thank you so much 😄
Copy link to clipboard
Copied
Copy link to clipboard
Copied
@Robert at ID-Tasker Thank you so much 😄 😄
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Yes! It is working like a magic. 👍👍
Copy link to clipboard
Copied
Great combo of efforts across the forums
Interesting challenge
Copy link to clipboard
Copied
So I am here again. Some font colours are very hard to see and I want to know if you can make the font bold alternatively like below. Please let me know what the additional GREP for making it bold. Thank you 😄
Copy link to clipboard
Copied
No Grep change, just include the "bold" option in the adhoc char style settings.
(^/)
Copy link to clipboard
Copied
Thank you! Worked 😄 😄
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thank you Eugene. Amazing!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now