Skip to content

Instantly share code, notes, and snippets.

@sakurabird
Created October 7, 2013 14:36
Show Gist options
  • Save sakurabird/6869046 to your computer and use it in GitHub Desktop.
Save sakurabird/6869046 to your computer and use it in GitHub Desktop.
emailの入力チェック
/**
* validate your email address format. [email protected]
*/
public static boolean emailValidator(String email) {
Pattern pattern;
Matcher matcher;
final String EMAIL_PATTERN = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
pattern = Pattern.compile(EMAIL_PATTERN);
matcher = pattern.matcher(email);
return matcher.matches();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment