Java Email Validate validateEmail(String email)

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

Description

validate Email

License

Apache License

Declaration

public static boolean validateEmail(String email) 

Method Source Code

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

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

public class Main {
    private static final String EMAIL_PATTERN = ".+@.+\\.[a-z]+";
    private static final int EMAIL_MAX_LENGTH = 256;

    public static boolean validateEmail(String email) {
        boolean isValid = false;
        Pattern emailPattern = Pattern.compile(EMAIL_PATTERN);
        Matcher m = emailPattern.matcher(email);
        if ((email.length() <= EMAIL_MAX_LENGTH) && (m.matches())) {
            isValid = true;//from ww w.j ava2  s. c  om
        }
        return isValid;
    }
}

Related

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