mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-12-27 21:38:51 +00:00
14 lines
491 B
Dart
14 lines
491 B
Dart
/// Input utilities
|
|
///
|
|
/// @author Pierre HUBERT
|
|
|
|
/// Check out whether a given email address is valid or not
|
|
///
|
|
/// Taken from https://medium.com/@nitishk72/form-validation-in-flutter-d762fbc9212c
|
|
bool validateEmail(String value) {
|
|
Pattern pattern =
|
|
r'^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$';
|
|
RegExp regex = new RegExp(pattern);
|
|
return regex.hasMatch(value);
|
|
}
|