Ah! I see what you meant now. I started learning Python and regex thanks to this add in. I like how elegent and streamlined that addition was, and it worked perfectly. Thanks for the input!
I tried using your suggestion in a number of different ways, but didn't have any luck. Where in the line were you expecting it to go?
Found the solution. For future reference, Python Scrip wants to see the single line flag used in the search. editor.rereplace(r"(^F1 VA \d+ )(?=[\s\S]*\1)",r"! \1")
Does Python Script support lookahead? I’m trying to get this regex to work, but it keeps failing. editor.rereplace(r"(^F1 VA \d+ )(?=.*\1)", r"! \1") For more backstory (and an example dataset), here’s a link to a reddit post. https://www.reddit.com/r/regex/comments/eutmta/finding_duplicates_using_a_lookahead/ Thanks in advance for any input! This is driving me crazy.