-4

Notepad ++ (REGEX); Invert Selection,

The following 2 different codes, it works very nicely. :) now I want to combine these two different code!

\bhttps?:[^)''"\s]+.(?:jpg|jpeg|gif|png)

https://codereview.stackexchange.com/questions/20126/regex-to-get-all-image-links

^((?!hello).)*$

notepad++ Inverse Regex replace (all but string)

Community
  • 1
  • 1
Eren SAĞLAM
  • 11
  • 1
  • 4

1 Answers1

1

So you want to find and remove all rows not containing an image URL specified by the regular expression \bhttps?:[^)''"\s]+.(?:jpg|jpeg|gif|png)?

You can combine the two regular expressions like this:

^((?!\bhttps?:[^)''"\s]+.(?:jpg|jpeg|gif|png)).)*$

If you replace the lines with an empty string, you can then use the menu option "Edit - Line Operations - Remove Empty Lines" to remove the empty lines.

Another option is to use bookmarks:

Select the "Mark" tab from the replace dialog and enter your first regular expression (the one that finds the image URL's). Check "Bookmark lines" and click "Mark all". From the menu, first select "Search - Bookmark - Inverse Bookmark", and then "Search - Bookmark - Remove Bookmarked lines" to remove the lines.