Home > other >  Notepad replace / remove lines that are different?
Notepad replace / remove lines that are different?

Time:07-01

I have a file with listed vhosts and locations, opened in Notepad . I Would like to remove complete lines of the locations but all are different.

Example:
(/var/www/vhosts/domain1.com/vhost.conf:1)
(/var/www/vhosts/domain2.com/vhost.conf:5)
(/var/www/vhosts/domain3.com/vhost.conf:1)
(/var/www/vhosts/domain4.com/vhost.conf:8)

Same issue with IP adresses, although they are mostly the same, except for IPv6.

Example:
[2021:41d0:a:1c12::199]
[2021:41d0:a:1c12::699]
[2221:41d0:a:1c12::99]
[2222:41d0:a:1c12::99]

I would like to remove these lines completely with search and replace. I am unable to find a good tutorial and help is unclear to me cause i know nothing about regex.

Please help :)

CodePudding user response:

In Notepad try \(. ?\)|\[. ?\] which matches a set of parenthesis or square brackets and everything between them.

Regex101

Make sure the regular expression checkbox is checked.

  • Related