/**
* validateEmail
* @param email, email address
* @return boolean, if email valid
*/
private static boolean validateEmail (string email) {
string emailRegex = '^[a-zA-Z0-9._|\\\\%#~`=?&/$^*!}{+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}$';
pattern outPattern = pattern.compile(emailRegex);
matcher outMatcher = outPattern.matcher(email);
return outMatcher.matches();
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter