Skip to content

Instantly share code, notes, and snippets.

@ArefMozafari
Created February 22, 2021 12:50
Show Gist options
  • Save ArefMozafari/8e740c03e75b4711f1fac41d5d943d4d to your computer and use it in GitHub Desktop.
Save ArefMozafari/8e740c03e75b4711f1fac41d5d943d4d to your computer and use it in GitHub Desktop.
Flutter/Dart - Regex that Checks if password has at least numericCount numeric character matches
//Checks if password has at least numericCount numeric character matches
bool hasMinNumericChar(String password, int numericCount) {
String pattern = '^(.*?[0-9]){' + numericCount.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