Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

GREP style for specific digits

New Here ,
Feb 15, 2021 Feb 15, 2021

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:
Zrzut ekranu 2021-02-15 o 09.44.30.pngexpand image

But only first two are working properly. Any idea why the third one don't change the font?

Zrzut ekranu 2021-02-15 o 09.47.13.pngexpand imageZrzut ekranu 2021-02-15 o 09.48.06.pngexpand imageZrzut ekranu 2021-02-15 o 09.48.42.pngexpand image

Thanks

TOPICS
Bug , How to , Type
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Feb 15, 2021 Feb 15, 2021

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+)

Translate
Guide ,
Feb 15, 2021 Feb 15, 2021

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 15, 2021 Feb 15, 2021

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

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Feb 15, 2021 Feb 15, 2021

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+)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 15, 2021 Feb 15, 2021

Thank you for a help! Worked!
Jakub

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Feb 15, 2021 Feb 15, 2021
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines