Skip to main content
ali u
Inspiring
January 20, 2023
Answered

GREP find anything inside parentheses individually

  • January 20, 2023
  • 2 replies
  • 598 views

I'm using this grep \(.+\) to find anything inside parentheses, but if there are two sets of parantheses in the same paragraph then it finds both of them together with whatever is between them, is there a way to limit this so it finds only the first set then the next?

This topic has been closed for replies.
Correct answer ali u

found it, \(.+?\) solves the problem, but when it is combined with other grep it still finds more than one set, to solve that problem you can look at this link: https://community.adobe.com/t5/indesign-discussions/how-to-combine-shortest-match-with-location-using-grep-styles/m-p/8833662 

2 replies

Community Expert
January 20, 2023

What if you have text like this

This is sample text (containing text within (parenthesis) as an example)

 

Plus your grep is inclusive of the parenthesis but you say anything inside.

 

Anyway - missing a very simple instruction
\(.+?\)

 

 

 

 

ali u
ali uAuthorCorrect answer
Inspiring
January 20, 2023

found it, \(.+?\) solves the problem, but when it is combined with other grep it still finds more than one set, to solve that problem you can look at this link: https://community.adobe.com/t5/indesign-discussions/how-to-combine-shortest-match-with-location-using-grep-styles/m-p/8833662