-2

I want a RegX for

input must have -1 Uppercase letters -1 Lowercase letters -1 Punctuation -1 Numbers

At lease 3 criteria matched from above.

Alan Moore
  • 73,866
  • 12
  • 100
  • 156
user
  • 793
  • 4
  • 14
  • 23

1 Answers1

0

Make it work with if expression.

What you can do is to check string in groups like this :

string pass = Password.Text;
            if (Regex.IsMatch(pass, @"(?=.*[a-z])(?=.*[A-Z])(?=.*\d).*") || Regex.IsMatch(pass, @"(?=.*[a-z])(?=.*[A-Z])(?=.*\W).*") || Regex.IsMatch(pass, @"(?=.*[a-z])(?=.*\d).*(?=.*\W).*") || Regex.IsMatch(pass, @"(?=.*[A-Z])(?=.*\d).*(?=.*\W).*"))
            {
                lbl.Text = "ahah..!!";
            }
            else
            {
                lbl.Text = "Oooops";
            }

Hope this will help you..!!

Naresh Ravlani
  • 1,600
  • 13
  • 28