How to find multiple words on one line in Notepad ++

I have a 4 MB log file from the Windows XP firewall that I am trying to find lines that have both DROP and IP address and port number. My regex-fu is weak, and I guess this is the reason I'm fighting.

The words "DROP", "10.1.1.1" (for example) and "8801" must be found on the same line and can be distributed on the line and separated by one or more other words.

Any help (or suggestions of another method for this) is greatly appreciated.

+4
source share
4 answers

The simplest solution should be:

DROP.*10.1.1.1.*8801 
+3
source

It will be done in notepad ++

 DROP.*10\.1\.1\.1.*8001 

Or a simple regular expression for different IP addresses (since you do not need to check the IP address itself)

 DROP.*\d\.\d\.\d\.\d.*8801 
+1
source

Notepad ++ RegEx does not seem to recognize curly braces that do not capture groups or \ b. The closest I could find is:
DROP\s.*[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+.*\s[0-9]+ or
DROP\s\d+\.\d+\.\d+\.+\d+.*\s\d+

-2
source

This question will help you solve a lot:

 DROP|\b(?:\d{1,3}\.){3}\d{1,3}\b|8801 
-3
source

Source: https://habr.com/ru/post/1304090/


All Articles