How to exclude a string

I want to exclude the string "VSS" from the message

VSS writer ran out of memory

RegEx, which I use for pattern matching,

[O,o]ut of [M,m]emory 

but if VSS comes in a message, I want to exclude this message entirely. Is it possible?

0
source share
1 answer

You can solve this problem using a negative look-up statement :

 (?i)^(?!.*VSS).*out of memory 

Explanation:

 (?i) # Make the regex case-insensitive ^ # Match the start of the string (?!.*VSS) # Assert that there is no "VSS" in the string .* # Match any number of characters out of memory # Match "out of memory" 

By the way, [O,o] matches O , O or , therefore, probably not what you meant.

+3
source

All Articles