Click here to Skip to main content
15,041,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to design configurable password rules from code behind.
1 caps + 1 numeric + 1 Special and length 8 to 12
Posted

You need to brush up on Regex. start from here:

The 30 Minute Regex Tutorial[^]

hope it helps :)
   
Comments
Milind Panchal 17-Apr-12 5:58am
   
Boss I want it from code behind with user defined values
C#
public static bool IsValidPassword (string input)
        {
Match match = Regex.Match(input, @"(?=^.{8,12}$)((?=.*\d)(?=.*[A-Z])(?=.*[a-z])|(?=.*\d)(?=.*[^A-Za-z0-9])(?=.*[a-z])|(?=.*[^A-Za-z0-9])(?=.*[A-Z])(?=.*[a-z])|(?=.*\d)(?=.*[A-Z])(?=.*[^A-Za-z0-9]))^.*");

            if (match.Success && match.Index == 0 && match.Length == input.Length)
				return true;
			else
				return false;

        }
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900