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

Help with GREP please?

Engaged ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

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!

TOPICS
Type

Views

310

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

Community Expert , Jul 11, 2022 Jul 11, 2022

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.

Votes

Translate

Translate
Community Expert ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

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

 

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
Engaged ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

Thanks Lukas. In my example although the 'd' and 'f' are lowercase when copy-pasted here, they're capitalised in my document where the GREP changes them.

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
Engaged ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

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.

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 ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

changing the "s" in the above expression to \w+ would probably catch all possible cases, but I'm curious why simply setting Title Case as part of the style for the paragraph isn't the easier option?

Title Case capitalizes every word no matter how it's keyed and the usual question we get for it is how to prevent it from capitalizing certain short words like and or of.

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
Engaged ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

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.

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 ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

Son of a gun, you're right. No way to apply title case except through using the Change Case command on selected text. Seems like that ought to be an available setting...

SO...

Why not set your text, the select all and Change Case?

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 ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

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.

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
Engaged ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

Thanks for the help Peter. Yes this would be a handy option to have within the styles.

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 ,
Jul 11, 2022 Jul 11, 2022

Copy link to clipboard

Copied

LATEST

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

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

 

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