Created
October 4, 2023 00:29
-
-
Save rafaelqueiroz88/53ef147a7b60bb1b485b4b9f58dcd3f9 to your computer and use it in GitHub Desktop.
Dart Regular Expression (Refex)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* It forces strong passwords | |
* @require String password | |
* @return bool | |
* | |
* return true if password has: | |
* 1 capitalized character | |
* 1 special character | |
* 1 number | |
*/ | |
bool checkPasswordRequirements(String password) { | |
String pattern = r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#\$&*~]).{8,}$'; | |
RegExp regExp = new RegExp(pattern); | |
return regExp.hasMatch(password); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment