i want implement regex validaton passwords in swift? have tried following regex, not successful
([(0-9)(a-z)(!@#$%ˆ&*+-=<>)]+)([a-z]*){6,15}
my requirement follows: password must more 6 characters, @ least 1 capital, numeric or special character
you can use regex check check password strength
^(?=.*[a-z].*[a-z])(?=.*[!@#$&*])(?=.*[0-9].*[0-9])(?=.*[a-z].*[a-z].*[a-z]).{8}$
regex explanation : -
^ start anchor (?=.*[a-z].*[a-z]) ensure string has 2 uppercase letters. (?=.*[!@#$&*]) ensure string has 1 special case letter. (?=.*[0-9].*[0-9]) ensure string has 2 digits. (?=.*[a-z].*[a-z].*[a-z]) ensure string has 3 lowercase letters. .{8} ensure string of length 8. $ end anchor.
source - rublar link
Comments
Post a Comment