File: src/Helpers/email.js
/**
Checks if a string represents a properly formatted email address.
var a = 'tyler@KnowRe.com';
var b = 'tyler$KnowRe.com'
var c = window.isValidEmail(a);
var d = window.isValidEmail(b);
// c ==> true
// d ==> false
@method isValidEmail
@for window
@param {String} email A string which will be tested to see if it is a properly formatted email adddress.
@return {Boolean} Whether the string was a valid format or not
**/
window.isValidEmail = function(email) {
var regex = /^(([^<>()[\]\\.,;:\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,}))$/;
return regex.test(email);
};