I am trying to compare a string that is entered into a textbox on windows form as the text changes the checkboxes that represent the password strength will either check or uncheck.
It works fine for the the text length and updates properly but when compared to see if the password contains special characters such as &,#,$,_ etc.etc. using Regex.IsMatch it does not properly update here is part of the code I'm using.
Please tell me if this looks right?
if (password.Length <= 3)
{
if (Regex.IsMatch(password, @"/.[!,@,#,$,%,^,&,*,?,_,~,-,£,(,)]/", RegexOptions.ECMAScript))
{
Security = (SecurityLevel.Unsecure);
}
else
{
Security = (SecurityLevel.None);
}
}