PwdRegex¶
By using PwdRegex
, you can check if the password strength meets the requirements.
Quick start¶
"852Vast.".isPwd(RwdStrength3)
Password strength¶
Default value¶
Four password strength are provided by default:
- PwdStrength1:Password contains at least one letter and one number.
- PwdStrength2:Password contains at least one uppercase letter, one lowercase letter and one number.
- PwdStrength3:Password contains at least one letter, one number and one special character.
- RwdStrength4:Password contains at least one uppercase letter, one lowercase letter, one number and one special character.
Special character
Special character include !@#$%^&*.
Customize password strength¶
By implementing PwdStrength
, you can customize the expression corresponding to the password strength, for example:
object YourRwdStrength : PwdStrength {
override val regex: String
get() = "(?=.*[A-Z])(?=.*[a-z])(?=.*\\d)(?=.*[!@#\\\$%\\^&\\*\\.])."
}
Common combination shielding¶
isPwd
provides the parameter shouldNotAppear
, through which you can specify combinations that should not appear in the password, for example:
"852admin".isPwd(RwdStrength3, shouldNotAppear = arrayOf("123","admin"))