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

GREP style for specific digits

New Here ,
Feb 15, 2021 Feb 15, 2021

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

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.pngZrzut ekranu 2021-02-15 o 09.48.06.pngZrzut ekranu 2021-02-15 o 09.48.42.png

Thanks

TOPICS
Bug , How to , Type

Views

900

Translate

Translate

Report

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

Votes

Translate

Translate
Guide ,
Feb 15, 2021 Feb 15, 2021

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?

Votes

Translate

Translate

Report

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

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

 

Votes

Translate

Translate

Report

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

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Thank you for a help! Worked!
Jakub

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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