I want to write a Regex which would skip characters like <
& >
. Reason
Now, to represent this I came across this [^<>]
and tried using it in an console application, but it does not work.
[^<>]
string value = "shubh<";
string regEx = "[^<>]";
Regex rx = new Regex(regEx);
if (rx.IsMatch(value))
{
Console.WriteLine("Pass");
}
else { Console.WriteLine("Fail"); }
Console.ReadLine();
The string 'shubh<' should get failed, but I am not sure why it passes the match. Am I doing something rubbish?