Copy link to clipboard
Copied
Hello,
I'm working on a long document. There are lots of paragraphs which start with first word ALL CAPS. So I want to apply a paragraph style to all those paragraphs at once. So the problem is, I want to find and replace only the paragraphs which first word is ALL CAPS. Then I can apply the paragraph style to it. Anyone can help to find a Grep for this?
Attached a screenshot to get things clear. Please tell me if I didn't explained it clearly.
Copy link to clipboard
Copied
It makes a difference if the All Caps were keyed that way with the shift lock on or if they were applied to lowercase letters.
Copy link to clipboard
Copied
Very true.
So, if the text at the beginning of a paragraph was typed using actual uppercase letters, use a GREP search for:
^\u+
If the type is upper and lowercase, but formatted with the All Caps command use a Text search for text formatted as All Caps:
~Barb
Copy link to clipboard
Copied
You still need to be sure you're finding text at the start of the paragraph, though, and that first letter would have been typed as upper case and may or may not have all caps applied.
(?<=^\u)\l seems to find the string correctly up until I add the All Caps formatting at which point I get a Cannot find match error because the first letter is not styled as All Caps.
I suspect that if the first character in the paragraph is plain typed upper case and not styled as All Caps it is not possible to find the first word in the paragraph in all caps using Find/Change. I'd love it if one of the GREP ninjas could tell me I'm wrong and show us how it's done.
Copy link to clipboard
Copied
I don't write scripts, but I have every confidence that this could be scripted by checking the second character in a paragraph to see if All Caps is applied and if is true assign the paragraph style.
Copy link to clipboard
Copied
Seen as you can't do a find change to change things to UPPERCASE as with the Type>Change Case
It would be beneficial first to go the route of finding the uppercase at the beginning of a line
^\u+?
And changing this to All Caps
Then you can do the find change to find all the All Caps at beginning of a sentence
find
^.
format
All caps
Copy link to clipboard
Copied
That's a good idea.