0

Is anyone able to tell me what regex I should use to search with 2 conditional arguments within Notepad++.

if i have a line in a log that reads: "Packet : NTFY 11279 Int#0/5 MGCP 1.0"

and I want to search for all lines that contain "NTFY" and "Int#0/5" and ignore all other lines, what would the syntax of the regex be?

I know that "NTFY | Int#0/5" will search for lines with NTFY or Int#0/5 but that would not filter enough.

thanks.

1 Answers1

0

The info provided by ctwheels in the question comment is reasonable but I don't think it takes it far enough for Notepad++ and here's why:

While:

(?=.*NTFY)(?=.*Int#0/5)

matches the desired lines, it zero-length-matches at EVERY POSITION from the start of a line containing the search terms to the start of either search term on that line. Thus if your line looks like this:

zzzInt#0/5zNTFY

you will obtain 4 matches on that line instead of 1.

Changing the search expression slightly, to:

^(?=.*NTFY)(?=.*Int#0/5)

solves that problem and provides one hit per matching line.

sasumner
  • 93
  • 2
  • 5