Skip to content

Instantly share code, notes, and snippets.

@felangel
Created April 27, 2019 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felangel/d00012c16ec1bd47669cfb18d6630d6b to your computer and use it in GitHub Desktop.
Save felangel/d00012c16ec1bd47669cfb18d6630d6b to your computer and use it in GitHub Desktop.
[flutter_firbase_login] Validators
class Validators {
static final RegExp _emailRegExp = RegExp(
r'^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$',
);
static final RegExp _passwordRegExp = RegExp(
r'^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,}$',
);
static isValidEmail(String email) {
return _emailRegExp.hasMatch(email);
}
static isValidPassword(String password) {
return _passwordRegExp.hasMatch(password);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment