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

is it Possible to Generate Capital Letter for Every Group of Paragraphs using GREP ?

Enthusiast ,
Mar 28, 2022 Mar 28, 2022

Copy link to clipboard

Copied

Hi GREP Experts,

I wonder if i can use grep to copy every first letter of first word in lines of paragraphs in Index and Make it capital and put it over the lines (paragraphs) of those words , no matter if the word start by capital letter or small letter, so it will auto genearate those letters as Index by letter key like dictianary Automatically, Please have a look in the picture - generated Capital letters is between Rectangles :

Capital Letter for Every Paragraphs.jpg

is it Possible by GREP? and Thanks in Advance.

Best
Mohammad Hasanin
TOPICS
How to

Views

302

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 2 Correct answers

Community Expert , Mar 28, 2022 Mar 28, 2022

See here: https://creativepro.com/files/kahrel/indesign/index_skip.html

That's a script. With INDesign 2021 and later you can use this GREP query:

 

Find what: (\u).+\r(\1.+\r)+\K(?=(.))
Change to: $3\r

Votes

Translate

Translate
Community Expert , Mar 28, 2022 Mar 28, 2022

You'd better narrow it down to one-letter paragraphs so that you catch only the section letters:

 

Find: ^[a-z]$

Change: empty

Change format: All caps

 

It's probably better to apply a separate paragraph style to those section letters so that you can add space before. So you would add AllCaps as a property in the paragraph style.

 

But that works only if the font you use supports AllCaps.

 

P.

Votes

Translate

Translate
Community Expert ,
Mar 28, 2022 Mar 28, 2022

Copy link to clipboard

Copied

See here: https://creativepro.com/files/kahrel/indesign/index_skip.html

That's a script. With INDesign 2021 and later you can use this GREP query:

 

Find what: (\u).+\r(\1.+\r)+\K(?=(.))
Change to: $3\r

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
Enthusiast ,
Mar 28, 2022 Mar 28, 2022

Copy link to clipboard

Copied

Thanks a lot @Peter Kahrel , Have a Great Day.

 

Best
Mohammad Hasanin

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
Enthusiast ,
Mar 28, 2022 Mar 28, 2022

Copy link to clipboard

Copied

@Peter Kahrel , The GREP is Good but i Noticed that it Skip First A Capital and it generate small letters also , can this be ignored? Thanks again

After Test.jpg

Best
Mohammad Hasanin

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
Community Expert ,
Mar 28, 2022 Mar 28, 2022

Copy link to clipboard

Copied

Ah, that it doesn't do the A is unavoidable, you'll have to add the A manually.

 it generates small letters also

Sorry, I don't understand what you mean here.

P.

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
Enthusiast ,
Mar 28, 2022 Mar 28, 2022

Copy link to clipboard

Copied

Yes, i have to insert ( A ) letter manually, I mean can i avoid generating small letters? and many thanks to you

Best
Mohammad Hasanin

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
Enthusiast ,
Mar 28, 2022 Mar 28, 2022

Copy link to clipboard

Copied

if tried solution and worked by GREP to get rid of small letters :

Find : ^[abcdefghijklmonopqrstuvwxyz]+$
Change : EMPTY

 

Best
Mohammad Hasanin

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
Community Expert ,
Mar 28, 2022 Mar 28, 2022

Copy link to clipboard

Copied

You'd better narrow it down to one-letter paragraphs so that you catch only the section letters:

 

Find: ^[a-z]$

Change: empty

Change format: All caps

 

It's probably better to apply a separate paragraph style to those section letters so that you can add space before. So you would add AllCaps as a property in the paragraph style.

 

But that works only if the font you use supports AllCaps.

 

P.

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
Enthusiast ,
Mar 28, 2022 Mar 28, 2022

Copy link to clipboard

Copied

LATEST

Thanks Lot @Peter Kahrel 

Best
Mohammad Hasanin

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