eltra1n
eltra1n

Reputation: 51

trying to Exclude Strings from my Regex Search

I'm using the following expression to filter Oracle Java vulnerabilities from a list. This works just fine:

^(?!.*Oracle Java.*).*$

I'm having a tough time adding another string to exclude.

I got the expression from an earlier question here:

Regular Expression to exclude set of Keywords

I've tried all the examples from this link but the answer Tim gave was the only one that worked for me.

Does anyone know how I could add another string to this?

^(?!.*Oracle Java.*).*$

Upvotes: 2

Views: 72

Answers (1)

anubhava
anubhava

Reputation: 785481

You can use regex alternation inside the lookahead:

^(?!.*(Oracle Java|excluded1|excluded2).*).*$

Upvotes: 1

Related Questions