Created
October 7, 2013 14:36
-
-
Save sakurabird/6869046 to your computer and use it in GitHub Desktop.
emailの入力チェック
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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