Last active
March 15, 2023 11:46
-
-
Save Ankit-Slnk/e0edf24b4d495ac36282a95605157257 to your computer and use it in GitHub Desktop.
Form validation
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
static bool isValidEmail(String email) { | |
return RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+").hasMatch(email); | |
} | |
static bool isValidName(String name) { | |
return !name.contains(RegExp(r"[0-9!@#$%^&*()_+\-=\[\]{};':\\|,.<>\/?]")); | |
} | |
static bool isSpecialCharacter(String name) { | |
return RegExp(r"[!@#$%^&*()_+\-=\[\]{};':\\|,.<>\/?]").hasMatch(name); | |
} | |
static bool isNumber(String name) { | |
return RegExp(r"[0-9]").hasMatch(name); | |
} | |
static bool isUppercase(String name) { | |
return RegExp(r"[A-Z]").hasMatch(name); | |
} | |
static bool isLowercase(String name) { | |
return RegExp(r"[a-z]").hasMatch(name); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment