1. Idea: match with regular expression, use reverse reference, replace. Find (. +?) \1 Replace with $
(. +) \1 why not? Because quantifier priority, + will eat as much as possible, and then another one spit out, inefficient, use (. +?) \1 cancel quantifier First, try to eat less.
(.*? Why \1 is not good, because. * can match no characters in the case,. + requires at least one character, since it is the deletion of adjacent duplicate content, of course, requires at least one character.
2, delete adjacent duplicate rows, can be converted to delete adjacent duplicate content. There is only one line break in the middle, as follows: Find (. +?) (\ r \ n) \1 replaced by $.
Note: You must not use this (. *?) (\ r \ n) \1, which will result in the absence of a newline character, why?
Because (. *?) Can match null, followed by newline, inverse reference null, replaced by empty, resulting in the line break is not.
Delete adjacent duplicate content