
(?=.*^\1$) this is a positive lookahead assertion. \s+?^ this part matches all whitespace characters (newlines!) till the start of the next row => This removes the newlines after the matched row, so that no empty row is there after the replacement. The matched row is stored, because of the brackets around and accessible using \1 (.*?) matches any characters 0 or more times, but as few as possible (It matches exactly on row, this is needed because of the ". You need to check the options "Regular expression" and ". No sorting is needed for that and the duplicate rows can be anywhere in the file! This leaves from all duplicate rows the last occurrence in the file. Since Notepad++ Version 6 you can use this regex in the search and replace dialogue: ^(.*?)$\s+?^(?=.*^\1$)Īnd replace with nothing.
