-4

Regex to find all matches linewise where text1("abc") is present and text2("xyz") is not present anywhere in each line.

adarsha bv
  • 43
  • 2
  • 13

1 Answers1

1

As per your order ;)

Eg.

^(?!.*xyz).*abc.*

should do the trick.

It uses a negative look-ahead to make sure the line doesn't contain the text "xyz", followed by a test any text up to "abc". And to match the whole line, followed by any text.

Check it out here at regex101.

SamWhan
  • 8,296
  • 1
  • 18
  • 45