Exceptions in GREP search
Learn / Forums / General InDesign Topics / Exceptions in GREP search
Tagged: GREP
- This topic has 11 replies, 4 voices, and was last updated 4 years, 4 months ago by Talya Shachar Albocher.
-
AuthorPosts
-
-
September 23, 2014 at 8:23 am #70707Keith BarkerMember
Is it possible to formulate a GREP search to look for all instances of a word except where it appears in a web address or email address?
For example, search for all examples of Adobe but not those in http://www.adobesystems.com or [email protected]
Many thanks,
Keith
-
September 23, 2014 at 8:50 am #70708David BlatnerKeymaster
Would you want to find “adoberama” or “badobe” ?
Or are you just looking for Adobe as a word? If so, put a word boundary code before and after it (you can find the word boundary code in the @ fly-out menu to the right of the grep field) -
September 23, 2014 at 8:56 am #70709Keith BarkerMember
Hi David,
I would need to find Adobe, but also Adobe’s and Adobes.
-
September 23, 2014 at 9:02 am #70711David BlatnerKeymaster
You could use:
\b[aA]dobe'?s?\b
(that would also find upper or lower case A) -
September 23, 2014 at 9:11 am #70712Keith BarkerMember
That works, but still selects the adobe in [email protected]
-
September 23, 2014 at 9:22 am #70713David BlatnerKeymaster
Drat. Good point. How about
\b(?
(Added a negative lookbehind to say "make sure there's no at sign there") -
September 23, 2014 at 9:23 am #70714David BlatnerKeymaster
BTW, I see an extra space before the exclamation point… don’t include that. Not sure why our forum software stuck that in there.
-
September 23, 2014 at 9:29 am #70716Keith BarkerMember
Without the space it’s still selecting the adobe in http://www.adobe.com.
I’m about to leave the office now, so I’ll catch up with this later. Thanks for your help!
-
September 23, 2014 at 9:38 am #70718David BlatnerKeymaster
Well, we’re seeing the evolution and debugging of a grep expression in real time here. ;-)
How about:
\b(?
-
September 24, 2014 at 2:33 am #70732Keith BarkerMember
Thanks David for your help. I’ve got my search working. :)
-
October 7, 2018 at 8:51 pm #110765Jan LMember
Hi David,
I was trying to learn from this example, to resolve my challenge.
What I am looking for is as follows:I would like select all instances of the word: King
But not when it appears as part of longer name, such as: Thomas King — in these occasions it can stay as is.
Would you have a tip for me?
Thank you,
Jan
-
November 28, 2019 at 10:11 am #14323498Talya Shachar AlbocherMember
Thank you, this was a very helpful post
-
-
AuthorPosts
- You must be logged in to reply to this topic.