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

Give a Tab before and after an anchor marker using GREP

Enthusiast ,
May 13, 2023 May 13, 2023

Hi

I have few paragraphs where I have put an anchor marker at the beginning of the line. 

I now want to give a tab before and after that anchor marker.

Currently I am using a GREP query which work only if I do find and replace one by one. The moment I do change all it deletes the anchored object also.

The query which I use is Find what: ^~a and Replace with:  \t$0\t

I have attached screenshots.

What am I doing wrong ?

Thanks.

TOPICS
How to
1.2K
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

correct answers 2 Correct answers

Community Expert , May 13, 2023 May 13, 2023

Hi @Bedazzled532:

 

~a should be in parentheses so that InDesign can capture it and add it back with $0.

 

That said, Change works and Change all appears to remove them, but... check Story Editor. The anchors are still there. They just no longer appear in Layout view. I don't get it.

 

But here's a different approach: do one manually,  copy it to the clipboard and change by pasting. 

 

2023-05-13_12-05-49 (1).gif

~Barb

 

Translate
Enthusiast , Jul 04, 2023 Jul 04, 2023

@Barb Binder Found a way to achieve what I mentioned in my question. Actually took help of some expert in Facebook Group. Sharing the solution here so that anyone who face the same issue can use this code.

It's an InDesign bug that GREP does not work well with Anchors sometimes. 
Here we have to run GREP two times. First at add a tab before the anchor and then again run GREP to add a tab char after the anchor.

To add a Tab char before use following:
F: ^(?=~a)
C: \t

To add a Tab character after the an

...
Translate
Community Expert ,
May 13, 2023 May 13, 2023

Hi @Bedazzled532:

 

~a should be in parentheses so that InDesign can capture it and add it back with $0.

 

That said, Change works and Change all appears to remove them, but... check Story Editor. The anchors are still there. They just no longer appear in Layout view. I don't get it.

 

But here's a different approach: do one manually,  copy it to the clipboard and change by pasting. 

 

2023-05-13_12-05-49 (1).gif

~Barb

 

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
Enthusiast ,
May 13, 2023 May 13, 2023

@Barb Binder Thank you so much for the help. It seems that there is a bug. Anyway, I will follow your method. 

Thanks once again.

Regards

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
Enthusiast ,
May 15, 2023 May 15, 2023

@Barb Binder One question. Its out of the topic. How did you make this small video of steps? I mean through which software. Thanks

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 ,
May 15, 2023 May 15, 2023

Hi @Bedazzled532:

 

I use Snagit for my 30-second forum videos and screen shots, and Camtasia for my training webinars. (I'm an instructor.) Both from https://www.techsmith.com. I do think both are built into your OS, I just prefer the ease and editing functionality of these apps. 

 

Mac: https://support.apple.com/en-us/HT208721

Win: https://www.microsoft.com/en-us/windows/learning-center/how-to-record-screen-windows-11

 

~Barb

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
Enthusiast ,
Jul 04, 2023 Jul 04, 2023
LATEST

@Barb Binder Found a way to achieve what I mentioned in my question. Actually took help of some expert in Facebook Group. Sharing the solution here so that anyone who face the same issue can use this code.

It's an InDesign bug that GREP does not work well with Anchors sometimes. 
Here we have to run GREP two times. First at add a tab before the anchor and then again run GREP to add a tab char after the anchor.

To add a Tab char before use following:
F: ^(?=~a)
C: \t

To add a Tab character after the anchor use following:

F: ~a\K
C: \t

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 ,
May 13, 2023 May 13, 2023

You are very welcome, @Bedazzled532.

 

~Barb

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