Reputation: 1787
I have a regular expression to match combination of Lower case upper case and special characters.
var regLowerUpperSpecilaCase = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{7,50}$/;
Everything seems fine but when i put a space along with the lowercase uppercase and special character it does not recognize and failed.
inputtxt='aS!a uiuiqw';
inputtxt.match(regLowerUpperSpecilaCase)
Actually i want to match everything instead of digit. but combination must have lower case, upper case and special characters.
Can anybody put some light on it.
Upvotes: 0
Views: 112
Reputation: 98901
Based on your comments, this is what you need:
var myregexp = /^(?=.*[a-z]+)(?=.*[A-Z]+)(?=.*[ !"#$%&\/()=?@.£§€{[\]}]+)(^.{7,50}$)$/;
It will need a combination of, at least, one uppercase, lowercase and special character (including space), with a minimum length of 7 and maximum of 50 characters to validate.
Upvotes: 1
Reputation: 9644
From what I understood, you want to validate a string with at least a lowercase, at least an uppercase, and at least something else (but no digit).
If everything which is not a letter or a digit is a special character (so a space is a special character), try
^(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])[^0-9]+$
If that doesn't suit you, please, please, give examples of strings that should match or shouldn't match. A lot of them. By editing your question.
Good luck.
Upvotes: 2