Can someone give me the regex to match a valid AWS Cognito password - with numbers, special characters (their list), lower and upper case letters
The AWS Cognito default length limit is 6 characters and has it's own list of special characters
/^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[\^$*.[\]{}()?"!@#%&/\\,><':;|_~`=+\- ])[A-Za-z0-9^$*.[\]{}()?"!@#%&/\\,><':;|_~`=+\- ]{8,256}$/
/
Indicates the start of a regular expression.^
Beginning. Matches the beginning of the string.(?=.*[a-z])
Requires lowercase letters.(?=.*[A-Z])
Requires uppercase letters.(?=.*[0-9])
Requires numbers.(?=.*[\^$*.[\]{}()?"!@#%&/\\,><':;|_~`=+\- ])
Requires at least one special character from the specified set. "The space character is treated as a special character." AWS Cognito
[A-Za-z0-9^$*.[\]{}()?"!@#%&/\\,><':;|_~`=+\- ]{8,256}
Minimum 8 characters from the allowed set, maximum 256 characters.$
End. Matches the end of the string./
Indicates the end of a regular expression.The minimum character limit defaults to 8 but can be customised to a value between 6 and 99. The full length of a password however is limited to 256 characters (not 99).
the Regex formula for Swift 5 is
"(.*[()!@^$*.?\\-@#%&\":;|><'_~`+=\\[\\],{}])"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With