As an alternative to regulare expressions. A simple approach would be:
- validate length: if password is too short or too long, reject it
- validate characters
Further details for point 2:
set
num_count = 0
,
alpha_count = 0
, then, for each character of the password, if
- it is a numeric character, increment
num_count
- it is an alphabetic character, increment
alpha_count
at the end of the loop, if
num_count
is
not equal to
1
or alpha_count
is
not equal to
5
then reject the password.