Copy link to clipboard
Copied
Hi all,
I'm working on a book and I'm having an issue with GREP. I have a list of excercises in a following manner (to be clear - Zad. is a shortcut from 'Zadanie', meaning an 'Exercise' in English):
Zad.1 (main exercise)
Zad.1.2 (secondary exercise)
Zad.1.3
Zad.2 ... etc
Analogically, I have 2-digit numbers exercises: Zad.10, Zad.10.1, Zad. 10.2 etc. and 3 digit: Zad.100., Zad.100.1, Zad.100.2, Zad.101.
I would like to change "Zad." to a specific character style, only if it's followed by a secondary exercise. Wrote 3 greps:
But only first two are working properly. Any idea why the third one don't change the font?
Thanks
1 Correct answer
However in your case you don't need 3 grep style.
One grep style is enough
Try this grep
Zad\.(?=\d{1,3}\.\d+)
or this one
Zad\.(?=\d+\.\d+)
Copy link to clipboard
Copied
Maybe I didn't understand your issue.
Zad.3.1
Zad.3.2
Zad.12.1
Zad.12.2
Zad.108.1
Zad.108.2
On your screenshot I see that all this cases are in Comic sans
I missed something?
Copy link to clipboard
Copied
I have a whole book made with a Lato font. I need to change prefixes: "Zad." to a specific character style (e.g. Comic Sans - it doesn't matter for now), only if they stand before secondary exercieses (x.1, x.2 etc). With the GREPs I sent above, it works only for one-digit and two-digit. In three-digit examples (see the screenshot) - it doesn't. The main exercise number is being changed to Comic. I need it to stay in Lato (as on two first screenshots). Any ideas for that?
Sorry maybe I posted my question wrongly.
Jakub
Copy link to clipboard
Copied
However in your case you don't need 3 grep style.
One grep style is enough
Try this grep
Zad\.(?=\d{1,3}\.\d+)
or this one
Zad\.(?=\d+\.\d+)
Copy link to clipboard
Copied
Thank you for a help! Worked!
Jakub
Copy link to clipboard
Copied
You have to insert "\" before any dot "."
the dot "." without "\" means any character
In your case for example your second grep style Zad.(?=\d\d.\d) means find Zad + any character with positiv lookahead any digit + any digit + any character
In this case your grep style finds Zad.108 too

