Hello, @blake-g.-barrington, @peterjones, @coises and All,
Here is my version to get duplicate lines, separated by any number of lines ( whatever they are : true empty lines, blank lines or lines with text ), even zero line :
MARK (?-si)^(.+)(?=(.*\R)+\1$)
As said by @Peterjones, and after some tests, this kind of regex get into trouble when the bunch of lines, between two duplicate lines, exceeds 15,000 empty lines about !
Now, Let’s suppose you create this text file :
first
0002
0003
0004
0005
....
....
....
9997
9998
9999
10000
first
Then the (?-si)^(.+)(?=(.*\R)+\1$) regex returns :
Correct result until the number of the in-between lines does not exceed 1,600, with the message 1 match in entire file
Correct result until the number of the in-between lines does not exceed 12,000, although the error message Find Invalid Regular Expression ( So F.I.R.E. !! ) occurs !
NO result at all if the number of lines is over 12,000 lines, with, of course, the error message Find Invalid Regular Expression
Best Regards,
guy038
P.S. :
I should add that my Windows11 laptop has 32 Gb of memory !