1

Is it possible to create a GREP function that will automatically change the first letter to capital letter in a word? For example: "moonlight" and GREP changes it to "Moonlight". Don't want to use Find/replace, because I want to embedded in alinea style.

Thanks for the help!

2
  • Like, every word in a story, or just specific words ?
    – Lucian
    Aug 8 at 10:33
  • Just a specific word. If i import text into Indesign, it would automatically change the word "moonlight" to "Moonlight". In that case, I don't have to worry about it Aug 8 at 10:36

2 Answers 2

1

In general you can't use styles in InDesign to change the content of a text - only the appearance.

But in this specific case, it is actually possible because uppercase can be styled.

Make a Character Style where you set Basic Character Formats to All Caps. You can call it "Uppercase" or something like that.

In the Paragraph Style where you want the substitution to take place, make a GREP Style like this:

This applies the style "Uppercase" to text which matches the pattern: \<m(?=oonshine\>).

It selects an m in the beginning of a word \<, using a Positive Lookahead (?=) to make sure it's followed by oonshine which is the end of the word \>.

This seems to work well:

What might be a problem though, is that the character m isn't actually being substituted. It's just styled. So if you copy/paste the word from InDesign to another application, it won't be capitalized.

If you export a PDF and copy/paste from that, the word will be capitalized though. So it might not be a problem for you.

I wouldn't personally do it like this, as I think it obscures what's going on in your document. I would just perform a find/change at some point.

You could also look into using Autocorrect, but it only works when typing the word letter by letter - not if you paste it in.

0

I don't think you can.

You can use GREP Styles to change the formatting of a specific word, that includes applying a full uppercase formatting, but without an option to capitalize the first letter of a specific word.

As per the name, styles can only affect the formatting, not the content, in a story. Yes, you need a minor change, but I don't think that's what they made the styles for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.