C# C# Console

How to Check Password Validity in C#

In this article, we will write a C# program to check password.

While creating a password, you may have seen the validation requirements on a website like a password should be strong and have −

  • Min 8 char and max 14 char
  • One lower case
  • No white space
  • One upper case
  • One special char

Let us see how to check the conditions one by one −

Min 8 char and max 14 char

Atleast one lower case

No white space

One upper case

Check for one special character

Example 2:

The password should have:
1. min 6 char and max 12 char
2. No two similar chars consecutively
3. 1 lower case
4. 1 upper case
5. 1 special char
6. No white space

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.