I use this pattern : validate-email-address-in-javascript. (Remove slash /
delimiters and add the Dart delimiters : r'
'
).
bool isEmail(String em) {
String p = 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 regExp = new RegExp(p);
return regExp.hasMatch(em);
}
EDIT :
For more information on email validation, look at these posts : dominicsayers.com and regular-expressions.info . This tool may also be very useful : gskinner RegExr.
EDIT : Justin has a better one. I'm using the pattern he proposed.