Skip to main content
Spenno
Inspiring
July 11, 2022
Answered

Help with GREP please?

  • July 11, 2022
  • 2 replies
  • 810 views

Hi all. Please can anyone help with a GREP query? At the moment I want my sentences to have every word capitalised - but it's also putting the S after all apostrophe's in capitals ie '

The World’S First double flowered Polyanthus'

my GREP is:

\b[\u\l]

and the character style being applied is a simple Uppercase style.

Please can the above be amended to somehow avoid doing this after a hyphen?

Also how could I list specific words to be excluded? Ie the, or, is etc.

Thanks in advance!

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

Peter, as far as I've always been aware, Title Case is not an option with the paragraph style itself? Just small caps or all caps.


If you need to restrict this to only certain paragraph styles, I bet it's a pretty easy script for the scripting guys, and you could assign a keyboard shortcut to it.

2 replies

pixxxelschubser
Community Expert
July 11, 2022

The following grep style should work for all words with more than 2 letters. (Unfortunately, you did not specify the exceptions).

\<\l(?=\l{2,})

 

Lukas Engqvist
Community Expert
July 11, 2022

Are you wanting to do this in a GREP style or as a Find/Change? (Change case to title case will capitals on each word.)
In your example why not Captal D and Capital F? 
Sometimes easier to do two simple things than solve in one search /GREP style.

The second one you want is a "positive lookbehind apostraphy s" 

(?<=')s

 

Spenno
SpennoAuthor
Inspiring
July 11, 2022

Please excuse my ignorance Lukas but how can I add further examples to the same GREP please? For example this one is perfect or who's or what's etc but how about words that end 'll or 'd etc? I seem to recall examples can be listed with the | between them? Thank you again Lukas.

Peter Spier
Peter SpierCorrect answer
Community Expert
July 11, 2022

Peter, as far as I've always been aware, Title Case is not an option with the paragraph style itself? Just small caps or all caps.


If you need to restrict this to only certain paragraph styles, I bet it's a pretty easy script for the scripting guys, and you could assign a keyboard shortcut to it.