Android Email String Validate isEmailValid(String email)

Here you can find the source of isEmailValid(String email)

Description

is Email Valid

Declaration

public static boolean isEmailValid(String email) 

Method Source Code

//package com.java2s;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static boolean isEmailValid(String email) {
        String regExpn = "^(([\\w-]+\\.)+[\\w-]+|([a-zA-Z]{1}|[\\w-]{2,}))@"
                + "((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
                + "[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\."
                + "([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
                + "[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|"
                + "([a-zA-Z]+[\\w-]+\\.)+[a-zA-Z]{2,4})$";
        CharSequence inputStr = email;
        Pattern pattern = Pattern
                .compile(regExpn, Pattern.CASE_INSENSITIVE);
        Matcher matcher = pattern.matcher(inputStr);
        if (matcher.matches())
            return true;
        else/*from  w  w  w  .  j a  v  a 2 s . com*/
            return false;
    }
}

Related

  1. isValidEmail(CharSequence target)
  2. isValidEmailAddress(String email)
  3. isEmailValid(CharSequence email)
  4. isEmail(String email)
  5. isEmail(String str)
  6. checkMail(String email)
  7. isEmail(String s)
  8. isValidEmail(String email)
  9. isValidEmail(CharSequence target)