Regular Expressions 101

Community Patterns

Community Library Entry

3

Regular Expression
PCRE (PHP <7.3)

/
^(.*?)$\s+?^(?=.*^\1$)
/
gms

Description

"dot matches newline" must be activated. Search and replace by "" (empty string) removes duplicate lines anywhere in text.

Example for Notepad++ use shown under http://stackoverflow.com/questions/3958350/removing-duplicate-rows-in-notepad

Submitted by Stackoverflow user stema - 9 years ago