title | tags | ||
---|---|---|---|
How to Remove UNIQUE lines only (opposite of remove duplicates) in VS Code with simple `cmd+f` & REGEX |
|
How to Remove UNIQUE lines only (opposite of remove duplicates) in VS Code with simple cmd+f
& REGEX
- Use
cmd+f
to open the 'Find' dialog box - Click the button to 'Use Regular Expression', it looks like a
.*
- Enter this REGEX (below) into the box, and click "Replace All" (hotkey:
cmd+enter
)
^(.+)$(?=\n(?:.*\n)*?\1$)
You will now be left with only the lines that were UNIQUE in the file (aka all of the items that had duplicates were removed, including the originals)