It doesn’t matter how many letters and digits, but string should contain both.
Jquery function $('#sample1').alphanumeric() will validate given string is alphanumeric or not. I, however, want to validate that it contains both.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
So you want to check two conditions. While you could use one complicated regular expression, it’s better to use two of them:
This makes your program more readable and may even perform slightly better (not sure about that though).