Highlighted

InDesign GREP eror

Community Beginner ,
Jun 15, 2020

Copy link to clipboard

Copied

When searching items between Parenthesis () with the GREP method \(.+\) why do I get selected the text starting from the first "(" untill the last ")" in that paragraph, if there is more than one () in that paragraph?

it should have select only one "(" to the next ")"

or maybe i'm using GREP wrong?

see photo

Annotation 2020-06-15 192726.png

Adobe Community Professional
Correct answer by Manan Joshi | Adobe Community Professional

You coukd try the following

\(.+?\)

Which means select as small no. of characters as possible in between () so this should fix you issue

 

-Manan

Topics

How to, Type

Views

138

Likes

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

InDesign GREP eror

Community Beginner ,
Jun 15, 2020

Copy link to clipboard

Copied

When searching items between Parenthesis () with the GREP method \(.+\) why do I get selected the text starting from the first "(" untill the last ")" in that paragraph, if there is more than one () in that paragraph?

it should have select only one "(" to the next ")"

or maybe i'm using GREP wrong?

see photo

Annotation 2020-06-15 192726.png

Adobe Community Professional
Correct answer by Manan Joshi | Adobe Community Professional

You coukd try the following

\(.+?\)

Which means select as small no. of characters as possible in between () so this should fix you issue

 

-Manan

Topics

How to, Type

Views

139

Likes

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
Adobe Community Professional ,
Jun 15, 2020

Copy link to clipboard

Copied

You coukd try the following

\(.+?\)

Which means select as small no. of characters as possible in between () so this should fix you issue

 

-Manan

Likes

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
Reply
Loading...
Most Valuable Participant ,
Jun 16, 2020

Copy link to clipboard

Copied

^^ because by default GREP is greedy: it tries to match as much as possible with each of the '+', '*', and '{..}' repeat modifiers.

 

You can see this (more obvious) if you search for something simple like

a+

 

If GREP was not greedy, it would only select the very first occurrence of an 'a' -- usually not what you would want here! (Because then why have a '+' there.) Adding a '?' immediately after the repeat modifier changes the behavior to match as soon as possible. For example, where 'a+' would match all the 'a's in "aaargh!", 'a+?' only matches the first one.

Likes

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
Reply
Loading...
Community Beginner ,
Jun 18, 2020

Copy link to clipboard

Copied

thank you manan, your answer is correct.

this GREP code \(.+\) is selectin all items in aparragraph that is in between ()

hershy_schnitzler_0-1592535963828.png

and this GREP code \(.+?\) is selecting only one () at a time

 

Annotation 2020-06-18 230800.png

Likes

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
Reply
Loading...
Adobe Community Professional ,
Jun 15, 2020

Copy link to clipboard

Copied

Another option could be

\([^()]+\)

 

Which basically means select all characters between () which are any characters but not ()

 

-Manan

Likes

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
Reply
Loading...