\A(?=\S*?[AZ])(?=\S*?[az])(?=\S*?[0-9])\S{6,}\z
(this comes from the JGSoft regular expression flavor).
Basically, the purpose of this regular expression is: βPassword complexity Tests if the input consists of 6 or more characters. The input must contain at least one uppercase letter, one lowercase letter and one number.
Thus, there are three groups that can be placed in any order (first capital letters, then non-capital letters, then numbers). \ A corresponds to the beginning of a line, and \ z corresponds to the end of a line. I got a little confused in (? = Part. This should be a positive look. I don't see how this regular expression allows you to enter password characters in any order.
source share