Shaul Behr Shaul Behr - 1 year ago 57
C# Question

C# Regex to match a string that doesn't contain a certain string?

I want to match any string that does not contain the string "DontMatchThis".

What's the regex?

Answer Source

try this:

^(?!.*DontMatchThis).*$