There seems to be a lot of confusion here. The answers I see so far don't correctly enforce the 1+ number/1+ lowercase/1+ uppercase rule, meaning that passwords like abc123, 123XYZ, or AB*&^# would still be accepted. Preventing all-lowercase, all-caps, or all-digits is not enough; you have to enforce the presence of at least one of each.
Try the following:
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,15}$
If you also want to require at least one special character (which is probably a good idea), try this:
^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,15}$
The .{8,15}
can be made more restrictive if you wish (for example, you could change it to \S{8,15}
to disallow whitespace), but remember that doing so will reduce the strength of your password scheme.
I've tested this pattern and it works as expected. Tested on ReFiddle here: http://refiddle.com/110
Edit: One small note, the easiest way to do this is with 3 separate regexes and the string's Length
property. It's also easier to read and maintain, so do it that way if you have the option. If this is for validation rules in markup, though, you're probably stuck with a single regex.