Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

GREP exclusion question

Explorer ,
Jun 18, 2019 Jun 18, 2019

Hi everyone.

I've been reading all kinds of posts and trying different things as per suggestions but I'm still a bit stumped.

I have a large document and need to go through searching for him, his, he and change to his/hers etc. I am using the expression

\bhe\b|\bhis\b|\bhim\b to find the whole words I need which works fine. But once I've changed "him" for example to "him/her" the same instance of remains in the results when I hit 'NEXT'. So every time I make a correction, it starts me back at the first instance I've corrected. 

What I would like to do is to exclude any instances of previous corrections in the search. So I want to find "his" but not "his/hers". Seems simple enough, but I'm still struggling with how to employ [ ] or ( ) to achieve this. Any help would be greatly appreciated.

569
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 19, 2019 Jun 19, 2019

maybe I didn't understand very well which text exactly you try to find and replace,

but try this grep and let us know

find

\bhe\b|\bhis\b(?!/hers)(?!/her)|\bhim\b(?!/hers)(?!/her)

replace:

his/hers

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 19, 2019 Jun 19, 2019

Vladan, you are spot on but a note on your lookaheads: you don't need both "/her" and "/hers" as the first will also match the second. Perhaps you meant an exact word match "/her\b" and "/hers\b", as you used for the first word.

(The advantage of having exact matches only is that it won't work on unexpected variants and accidental typos.)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 19, 2019 Jun 19, 2019

Thanks to you both. So I'm now using this: \bhe\b|\bhis\b|\bhim\b(?!/hers)(?!/she)(?!/hers)(?!/her)

but it is still finding previously corrected "his/her", "he/she" entries.

To be extra clear, this is an example of the text I'm starting with:

"...many procedures and regulations which a pilot must know and which he must follow..."

" Terrain and collision avoidance are his responsibility."

I do a search for  \bhe\b|\bhis\b|\bhim\b and correct to:

"...many procedures and regulations which a pilot must know and which he/she must follow..."

" Terrain and collision avoidance are his/her responsibility."

However even with the GREP code \bhe\b|\bhis\b|\bhim\b(?!/hers)(?!/she)(?!/hers)(?!/her) it is still finding "he" in previously corrected "he/she" instances which is a huge problem because of the massive size of the document I'm working on. On some pages there are six or more instances that need to be corrected in a 200+ page text.

Am I doing something wrong or missed a detail somewhere.

thanks again everyone.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 20, 2019 Jun 20, 2019

1) if you wanto to change: he to he/she you can use this grep

find:

\bhe\b(?!/she)

change to:

he/she

2) if you wanto to change: his to his/her you can use this grep

find:

\bhis\b(?!/her)

change to:

his/her

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 20, 2019 Jun 20, 2019
LATEST

Daniel -- What you describe is not related to the form of the GREP expression, but to InDesign's behaviour. To get around that, use 'To end of story' as the search scope.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines