Skip to content

Instantly share code, notes, and snippets.

@sivajankan
Created November 18, 2015 19:55
Show Gist options
  • Save sivajankan/dcb27e3f0dc9678af6fb to your computer and use it in GitHub Desktop.
Save sivajankan/dcb27e3f0dc9678af6fb to your computer and use it in GitHub Desktop.
public static boolean is_valid_email(String email) {
String email_pattern = "[^\\s]+@[^\\s]+.[^\\s]+";
java.util.regex.Pattern r = java.util.regex.Pattern.compile(email_pattern);
try {
java.util.regex.Matcher m = r.matcher(email);
return m.matches();
} catch (java.lang.NullPointerException e) {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment