-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
  • 71,299
  • 12
  • 93
  • 154
user
  • 763
  • 3
  • 14
  • 22

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,538
  • 12
  • 26