2

I have currently a pattern match in a query like this

if(upper(email_omni_code_mini) like '%TRAVEL%' and upper(email_omni_code_mini) NOT like '%TRAVEL%ENS%',...,...)

I want to change this to a single pattern match but this won't work TRAVEL(?!ENS) as ENS is not immediately following.

Is there a way to solve this easily.

Any help is appreciated.

Akshay Hazari
  • 2,995
  • 3
  • 40
  • 76

1 Answers1

1

If there are other chars in between, insert .* before ENS:

TRAVEL(?!.*ENS)

It will now match TRAVEL that is not immediately followed with any 0+ chars as many as possible followed with ENS substring.

See the regex demo.

Wiktor Stribiżew
  • 561,645
  • 34
  • 376
  • 476