Android Email String Validate isEmail(String text)

Here you can find the source of isEmail(String text)

Description

is Email

Declaration

public static boolean isEmail(String text) 

Method Source Code

//package com.java2s;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.text.TextUtils;

public class Main {
    public static final String regEmail = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";

    public static boolean isEmail(String text) {
        if (TextUtils.isEmpty(text)) {
            return false;
        }/*from w  w  w. j a v  a 2 s .c  o m*/

        Pattern pattern = Pattern.compile(regEmail);
        Matcher matcher = pattern.matcher(text);
        return matcher.find();
    }

    public static boolean isEmpty(String text) {
        if (text == null || text.length() == 0) {
            return true;
        }
        return false;
    }
}

Related

  1. isEmail(String strEmail)
  2. getNameFromEmail(String email)
  3. isLegalEmail(String email)
  4. isEmail(String str)
  5. isEmail(String email)
  6. isEmailFormat(String email)
  7. isValidEmail(CharSequence target)
  8. isValidEmailAddress(String email)
  9. isEmailValid(CharSequence email)