+ 3
Struggling with Regex to Valid Password
The password should have atleast 2 numbers and 2 special characters... here with my regex any help will be appreciated "((?=.*\\d{2})(?=.*[a-z])(?=.*[A-Z])(?=.*[@#
amp;*!%]{2}).{7,})”;3 Respuestas
+ 2
This can be solved e.g.:
string si = Console.ReadLine();
Regex r1 = new Regex(@"(?<psw>[^0-9]+)");
Regex r2 = new Regex(@"(?<psw>[^!\@\#\$%&\*]+)");
string s1 = r1.Replace(si,"");
string s2 = r2.Replace(si,"");
if(s1.Length>=2 && s2.Length>=2 && si.Length>=7){
Console.Write("Strong");
} else {
Console.Write("Weak");
}
0
(?=(.*\d){2,}) at least 2 digits
0
Thanks let me try your code