Skip to main content
M.Hasanin
Inspiring
March 28, 2022
Answered

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

  • March 28, 2022
  • 1 reply
  • 724 views

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 :

is it Possible by GREP? and Thanks in Advance.

This topic has been closed for replies.
Correct answer Peter Kahrel

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

Find : ^[abcdefghijklmonopqrstuvwxyz]+$
Change : EMPTY

 


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.

1 reply

Peter Kahrel
Community Expert
Community Expert
March 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
M.Hasanin
M.HasaninAuthor
Inspiring
March 28, 2022

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

 

Mohammad Hasanin