Weird behaviour of Find Change GREP

Participant ,
Sep 01, 2022 Sep 01, 2022

Copy link to clipboard

Copied

I have an object which I want to place after Footnote reference denoted by a character style named "Reference"

 

I copied the object by CTRL+C and doing a Find Change usign GREP.

 

Here are the Parameters of Find and Change:

F: ~F
R: $0~c
Find Format: Character Style: reference

 

The weird thing is that if I do Find and then Change it works but when I do Find and Change All, its pastes the object but instead of Footnote reference its shows <?>

 

Meaning Single Find/Change works but Find/Change All not working.

 

Attaching a screenshot.

How to resovle this issue ? Plz help.

Thanks and regards

TOPICS
How to

Views

53

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
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 01, 2022 Sep 01, 2022

Try the following

Find What:- (?<=~F)
Replace With:- ~c
Find Format: Character Style: reference

-Manan

Likes

Translate

Translate
Community Expert ,
Sep 01, 2022 Sep 01, 2022

Copy link to clipboard

Copied

Try the following

Find What:- (?<=~F)
Replace With:- ~c
Find Format: Character Style: reference

-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
community guidelines
Participant ,
Sep 01, 2022 Sep 01, 2022

Copy link to clipboard

Copied

Thank you so much Manan. It worked like a charm.

 

Just for the sake of learning, could you explain why lookbehind has been used ? As per the rules of lookbehind, it should find something if (?<=~F) is behind. Ideally there should be something after this (?<=~F).  I always get confused in this stuff. Thanks a lot once again for solving my issue.

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
community guidelines
Community Expert ,
Sep 01, 2022 Sep 01, 2022

Copy link to clipboard

Copied

There are two things

  • Why your approach of finding footnote reference and then replacing it did not work. Well this is a known thing and replacing footnote reference with itself does not work. So we needed to find an alternative
  • I used positive lookbehind to find the postion after the footnote reference. Now positive lookbehind mean to find a location which is preceded by the character, and since it does not capture what it matches it means that we have our cursor at the blank location after or searched term. So using lookbehinds/aheads in conjuction with other terms is a use case but not the only use case.

I hope this explains you my approach to the problem

See the following

https://regex101.com/r/8k0RC8/1

Notice the cursor right after e and the search result is null. So this is what a lookbehind/ahead means in itself.

-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
community guidelines
Participant ,
Sep 01, 2022 Sep 01, 2022

Copy link to clipboard

Copied

LATEST

Thank you so much Manan.

 

Your explanation was very helpful.

 

Regards

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
community guidelines

Save time with Adobe Express quick actions