0

I have these lines

http://dawn-ofthe-dead.blogspot.com/2008/02/amenra-hitch.html
http://dawn-ofthe-dead.blogspot.com/2008/0...enra-hitch.html
https://yadi.sk/mail/?hash=R041opeqcsTT3kmODt3qXcIAmcxOx1P78E1PqDOqJR8%3D
https://yadi.sk/mail/?hash=R041opeqcsTT3kmO...78E1PqDOqJR8%3D
https://mail.yandex.ru/message_part/2011%20-%20Amenra%20%26%20Oathbreaker%20(Split).rar?name=2011%20-%20Amenra%20%26%20Oathbreaker%20(Split).rar&hid=1.3&ids=2440000004701735584
https://mail.yandex.ru/message_part/2011%20..000004701735584
http://mediaboom.org/mp3/127749-amenra-mass-i-prayer-i-vi-2003.html
http://mediaboom.org/mp3/127749-amenra-mas....-i-vi-2003.html

I want remove strings with

..
...
....

because are similar almost duplicate strings.

I want this output

http://dawn-ofthe-dead.blogspot.com/2008/02/amenra-hitch.html
https://yadi.sk/mail/?hash=R041opeqcsTT3kmODt3qXcIAmcxOx1P78E1PqDOqJR8%3D
https://mail.yandex.ru/message_part/2011%20-%20Amenra%20%26%20Oathbreaker%20(Split).rar?name=2011%20-%20Amenra%20%26%20Oathbreaker%20(Split).rar&hid=1.3&ids=2440000004701735584
http://mediaboom.org/mp3/127749-amenra-mass-i-prayer-i-vi-2003.html

How regex? (I'm using Notepad++)

Super Sonic
  • 116
  • 9
  • You can try like this: Search for [`.*\.\..*\n?`](https://regex101.com/r/hW0aZ1/1) and replace by empty. – bobble bubble May 28 '16 at 12:00
  • Are the lines that you want to remove always follwoing the one without the dot? Would a check for 25 (or whatever number) equal characters at the start be suffivient? See [Regex101-Demo](https://regex101.com/r/lX2yP4/1) – Sebastian Proske May 28 '16 at 12:01
  • What is your expected output? – anubhava May 28 '16 at 12:07
  • @SebastianProske seems don't work `^(.{25,})(.*)$\n\1.*` I copy on notepad++ and select regular expression but it tell me **no matches** – Super Sonic May 28 '16 at 12:44
  • 2
    @SuperSonic yep, better use `^(.{25,})(.*)$\R\1.*` for the search pattern (and still `$1$2` for replace) - does this work for you? – Sebastian Proske May 28 '16 at 12:49
  • @SebastianProske Ok now it works - please write your answer so I can assign like solved. – Super Sonic May 28 '16 at 13:56
  • Possible duplicate of [How to delete specific lines on Notepad++?](http://stackoverflow.com/questions/918158/how-to-delete-specific-lines-on-notepad) – AdrianHHH May 29 '16 at 16:01

2 Answers2

4

To remove all lines that have 2 or more dots, I'll do:

  • Ctrl+H
  • Find what: ^.*\.\.+.*\R?
  • Replace with: NOTHING
  • Replace all
Toto
  • 89,455
  • 62
  • 89
  • 125
2

Under the condition, that the line you want to remove always follows the line without the dots, you can use the following (make sure regular expression is checked in Notepad++ replace dialog):

Search pattern: ^(.{25,})(.*)$\R\1.*

Replace pattern: $1$2

This is checking for 25 characters in one line, that are repeated in the next line - and removes this second line. Of course you can replace 25 by whatever number you feel appropriate to avoid false positives.

Sebastian Proske
  • 8,255
  • 2
  • 28
  • 37