Hello, I'm new to ASP.net and was wondering if you all could help with a password regular expression that I need to make: 1. must have minimum of 4 characters 2. must not exceed 8 characters (8 characters maximum) 3. must contain letters and numbers Thanks in advance to anyone that replies.
I havent checked this but this is 99% right. Firstly I return false if the password is the wrong length. Then I check to see if password matches the regex, note the regex may need a tweak but it basically says that it can contain only numbers and letters. public bool CheckPassword(String password) { if (password.Length < 4 || password.Length > 8) { return false; } return Regex.Match("([0-9a-fA-F])") } Code (markup):