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

I need a script similar to "Find Change From Spreadsheet" but for GREPs.

Participant ,
May 28, 2022 May 28, 2022

Copy link to clipboard

Copied

Hi

 

I have a problem with a GREP: when I do it one by one it works perfectly, but when I use Change all command it doesn't work, so I need a script to do the find and change one by one to the whole file, so it's something similar to Find Change From Spreadsheetbut with GREP instead of text.

TOPICS
How to , Scripting

Views

288

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 , May 28, 2022 May 28, 2022

Hi @AK09M, try this:

 

((?<=~F) | (?=~F))

 

This searches for a space with a footnote number before it OR a space with a footnote number after it.

- Mark

Votes

Translate

Translate
Community Expert ,
May 28, 2022 May 28, 2022

Copy link to clipboard

Copied

When it does not work, it is not find & replace.

Describe what you are missing.

Votes

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 ,
May 28, 2022 May 28, 2022

Copy link to clipboard

Copied

I have a space before and after every footnote number in the text and I want to remove them, I used

Find: (~F) 

Change to: $1

 

When I do it one by one it works perfectly, but when I use change all it doesn't work it turns them into squares.
see the link below for a sample of the file.

Votes

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 ,
May 28, 2022 May 28, 2022

Copy link to clipboard

Copied

Hi @AK09M, can you give an example of your GREP that works for one change but not for change all? I've never come across that before and I'd like to understand what happens. 
- Mark

Votes

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 ,
May 28, 2022 May 28, 2022

Copy link to clipboard

Copied

Votes

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 ,
May 28, 2022 May 28, 2022

Copy link to clipboard

Copied

Hi @AK09M, try this:

 

((?<=~F) | (?=~F))

 

This searches for a space with a footnote number before it OR a space with a footnote number after it.

- Mark

Votes

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 ,
May 28, 2022 May 28, 2022

Copy link to clipboard

Copied

LATEST

Thanks, that worked perfectly with my document.

Votes

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 ,
May 28, 2022 May 28, 2022

Copy link to clipboard

Copied

I tested your grep and had similar results to you. Thank you—that's an interesting edge case.

 

My guess is that because the footnote numbers are special objects, of which only a part is the text representation in the story, that when the grep engine picks one up and puts it back down as $1 it is messed up. My approach is to only focus on the spaces, not the footnote number.

- Mark

Votes

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