I'm trying to create a regex validation for a password which is meant to be:
- 6+ characters long
- Has at least one a-z
- Has at least one A-Z
- Has at leat one 0-9
So, in other words, the match will have :
- at least one a-z, A-Z, 0-9
- at least 3 any other characters
I've came up with:
((.*){3,}[a-z]{1,}[A-Z]{1,}[0-9]{1,})
it seems pretty simple and logical to me, but 2 things go wrong:
- quantifier
{3,}
for(.*)
somehow doesn't work and destroys whole regex. At first I had{6,}
at the end but then regex would affect the quantifiers in inner groups, so it will require[A-Z]{6,}
instead of[A-Z]{1,}
- when I remove
{3,}
the regex works, but will match only if the groups are in order - so that it will matchaaBB11
, but notBBaa11