Skip to content

Instantly share code, notes, and snippets.

@brownsoo
Created June 29, 2017 02:41
Show Gist options
  • Save brownsoo/b1cdee0551911f39802e57941a661160 to your computer and use it in GitHub Desktop.
Save brownsoo/b1cdee0551911f39802e57941a661160 to your computer and use it in GitHub Desktop.
e-mail regular expression (java)
// 이메일 정규표현식
public static boolean testEmailFormat(String text) {
if (TextUtils.isEmpty(text)) return false;
Pattern pattern = Pattern.compile("^(([^<>()\\[\\]\\\\.,;:\\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 pattern.matcher(text).matches();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment