Java Email Validate validateEmail(String email)

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

Description

validate Email

License

LGPL

Declaration

public static Boolean validateEmail(String email) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

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

public class Main {
    public static Boolean validateEmail(String email) {
        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;//from   w ww. ja  va2 s .c om
        Matcher matcher;
        pattern = Pattern.compile(EMAIL_PATTERN);
        matcher = pattern.matcher(email);
        if (email == null || "".equals(email) || !matcher.matches()) {
            return false;
        }
        return false;
    }
}

Related

  1. isValidEmailAddress(String emailAddress)
  2. isValidEmailAdress(String email)
  3. parseEmail(String target)
  4. validateEmail(String email)
  5. validateEmail(String email)
  6. validateEmail(String email)
  7. validateEmail(String email)
  8. validateEmail(String email)
  9. validateEmail(String email)