Skip to content

Instantly share code, notes, and snippets.

@ArefMozafari
Created February 22, 2021 12:49
Show Gist options
  • Save ArefMozafari/de068c25f9724ba5f70976d23de0f25c to your computer and use it in GitHub Desktop.
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
//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