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

Find/Replace script not recognizing GREP removal of duplicated lines

Community Beginner ,
Oct 26, 2023 Oct 26, 2023

I am modifying the "FindChangeByList" reference file to clean up a TV schedule. I've gotten everything to work so far except to remove the duplicate date lines.

I have the line highlighted in blue in my script, but it doesn't seem to do anything. When I enter those settings directly in the find/change GREP box it works fine. Just not when it's in the scrip. What am I missing?

For reference: I'm a total n00b at GREP and scripting so it's been a lot of google/copy/paste/trial/error. I'm attaching my unaltered schedule file and the "FindChangeList.txt" for reference.

 

Screen Shot 2023-10-26 at 4.40.51 PM.png

Screen Shot 2023-10-26 at 4.44.48 PM.png

TOPICS
Scripting
918
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 1 Correct answer

Community Expert , Oct 27, 2023 Oct 27, 2023

Works for me if I move the ^(.+\r)\\1+ search to first in the list and escape \1, so maybe the previous searches are affecting your ^(.+\r)\\1+ search. I’ve attached the text file.

 

 

Translate
Community Expert ,
Oct 26, 2023 Oct 26, 2023

Per the documentation for the script, you need to double escape bacsklashes: \\r and \\1

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 Beginner ,
Oct 27, 2023 Oct 27, 2023

Unfortunately that didn't work. Funnily enough, I've used the single \ in other instances without issue. But changing everything to \\ doesn't make a difference.

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 ,
Oct 27, 2023 Oct 27, 2023

Hi @_jessmoe_ , Try escaping \1, but not the return:

 

^(.+\r)\\1+
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 Beginner ,
Oct 27, 2023 Oct 27, 2023

No luck there either.

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 ,
Oct 27, 2023 Oct 27, 2023

Works for me if I move the ^(.+\r)\\1+ search to first in the list and escape \1, so maybe the previous searches are affecting your ^(.+\r)\\1+ search. I’ve attached the text file.

 

 

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 Beginner ,
Oct 27, 2023 Oct 27, 2023

That did it! Thank you!!

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 ,
Oct 28, 2023 Oct 28, 2023

Nice call, Rob. But how bizarre.

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 ,
Oct 29, 2023 Oct 29, 2023

Hi Peter, If I run only the first 3 items before the remove duplicate lines in @_jessmoe_ ’s F&C list, there is a return left between the duplicate dates. Running the ^(.+\r)\1+ Grep code from the UI returns no match:

 

Screen Shot 16.png

 

 

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 ,
Oct 30, 2023 Oct 30, 2023
LATEST

That's caused by the second grep entry:

{changeTo:"~b$0"}

introduces a paragraph break (~b)

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