I am building a user registration form using C# with .NET. I have a requirement to validate user entered password fields. Validation requirement is as below.
- It should be alphanumeric (a-z , A-Z , 0-9)
- It should accept 6-10 characters (minimum 6 characters, maximum 10 characters)
- With at least 1 alphabet and number (example:
stack1over
)
I am using a regular expression as below.
^([a-zA-Z0-9]{6,10})$
It satisfies my first 2 conditions. It fails when I enter only characters or numbers.