Created
February 22, 2021 12:49
-
-
Save ArefMozafari/de068c25f9724ba5f70976d23de0f25c to your computer and use it in GitHub Desktop.
Flutter/Dart - Regex that Checks if password has at least uppercaseCount uppercase letter matches
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
//Checks if password has at least uppercaseCount uppercase letter matches | |
bool hasMinUppercase(String password, int uppercaseCount) { | |
String pattern = '^(.*?[A-Z]){' + uppercaseCount.toString() + ',}'; | |
return password.contains(new RegExp(pattern)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment