Skip to main content
natlee123
Participant
April 30, 2026
Answered

GREP change style within parentheses once

  • April 30, 2026
  • 1 reply
  • 39 views

Hello, I’m formatting some text and would like to target characters within a set of parentheses, but only the first set (if more than one parenthetical occurs within the paragraph).

Example:

word (pronunciation) n. definition definition (second parenthetical); additional context 

Where only “(pronunciation)” would be styled and not “(second parenthetical)”. I found a prior thread with two strings that work to target all of the parentheticals within a paragraph. However, I don’t know how to only target the first parenthetical. I’ve tried to wrap the expressions in brackets and adding “?” or “+?” but those don’t work, and that’s the limit of my GREP understanding.

i.e.

((?<=\()[^)]+)+?

 

Is there a way to target only the first parenthetical in a paragraph? If it’s relevant, I’m also using a nested style to target the first word to apply a different style.

    Correct answer Peter Spier

    Just tested this…

    If you want the first word different from the rest of the words in parentheses, you need to put that nested style ahead of the one for the other words, so:

    None through 1 (

    first word style through 1 word

    remainder style up to 1 )

    1 reply

    Peter Spier
    Community Expert
    Community Expert
    April 30, 2026

    This seems to work for me:

    (?<=\().+?(?=\))(?=.+$)

    Peter Spier
    Community Expert
    Community Expert
    April 30, 2026

    The more I think about this, though, the more I wonder why you need GREP fir this instead of using an ordinary nested style:

    Nothing through 1(, then style up to 1)

    If you want the first word styled differently, I believe you can stack a second nested style after the first to style just one word after the first open parentheses

    Peter Spier
    Community Expert
    Peter SpierCommunity ExpertCorrect answer
    Community Expert
    April 30, 2026

    Just tested this…

    If you want the first word different from the rest of the words in parentheses, you need to put that nested style ahead of the one for the other words, so:

    None through 1 (

    first word style through 1 word

    remainder style up to 1 )