Created
February 22, 2021 12:50
-
-
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
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 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