Shaul Behr Shaul Behr - 4 months ago 19
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

try this:

^(?!.*DontMatchThis).*$