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

Simple GREP query with Groups not working as expected.

Community Beginner ,
Sep 18, 2022 Sep 18, 2022

Copy link to clipboard

Copied

I like having a hair space ahead of my footnote reference numbers when there is no period, comma or other terminator ahead of it. I'm presently working with almost 600 footnotes and this should be an easy matter.

 

I'm using the following GREP query and the results are totally unexpected (I get Group 1, twice) when calling for return of both Group 1 and Group 2, as follows:

Screen Shot 2022-09-18 at 7.17.26 PM.pngScreen Shot 2022-09-18 at 7.17.56 PM.pngScreen Shot 2022-09-18 at 7.18.27 PM.png

 

If I call for just Group 2 and the hair space I get what is expected:

Screen Shot 2022-09-18 at 7.52.47 PM.pngScreen Shot 2022-09-18 at 7.51.00 PM.png

 

If I call for Group 2, twice, I get a really weird outcome that includes Group 1:

Screen Shot 2022-09-18 at 7.46.41 PM.pngScreen Shot 2022-09-18 at 7.24.10 PM.png

 

Anyone have a thought?

TOPICS
Bug , How to , Type

Views

79

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 18, 2022 Sep 18, 2022

With respect to Grep, you can't use replace a footnote marker with itself, it cause issues. So to identify a footnote marker for your Grep, use positive lookahead. So your Grep expression would be something like

Find What :- ([\l\u])(?=~F)

So now you just have the match before the footnote reference in $1, change it to whatever you need.

Change To:- $1~|

-Manan

 

Likes

Translate

Translate
Community Expert ,
Sep 18, 2022 Sep 18, 2022

Copy link to clipboard

Copied

Gotta love GREP but there's a feature for that... 😊

 

note.png

 

~Barb

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 Beginner ,
Sep 18, 2022 Sep 18, 2022

Copy link to clipboard

Copied

Barb, the particular funtion you are pointing out is for the footnote text, not the reference number in the body text (unless I'm missing something). It's also an all-or-none solution. I don't want to add space when commas and periods preceed the footnote. Hence, what I want to do would not be a reasonable feature request.

 

My experience is based in regex and this is no-brainer within html. I think Manan has something I can work with. I really do appreciate your fast respons, though!

 

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 Beginner ,
Sep 18, 2022 Sep 18, 2022

Copy link to clipboard

Copied

Dang, I could only see the bottom half of the screenshot when I replied, so I was mistaken about locatiuon. My bad. Still, all-or-nothing...

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 18, 2022 Sep 18, 2022

Copy link to clipboard

Copied

With respect to Grep, you can't use replace a footnote marker with itself, it cause issues. So to identify a footnote marker for your Grep, use positive lookahead. So your Grep expression would be something like

Find What :- ([\l\u])(?=~F)

So now you just have the match before the footnote reference in $1, change it to whatever you need.

Change To:- $1~|

-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
Community Beginner ,
Sep 18, 2022 Sep 18, 2022

Copy link to clipboard

Copied

I will give this a try. Thanks, 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
Community Beginner ,
Sep 18, 2022 Sep 18, 2022

Copy link to clipboard

Copied

LATEST

Funny thing. I went through and did them manually, before I read your reply, and ended up catching other issues I may have missed. Now I ran your query and found some instances I missed when I ran through them, manually.

 

Works perfect. Thanks again!

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