Java Email Validate isEmailFormatValid(String emailAddress)

Here you can find the source of isEmailFormatValid(String emailAddress)

Description

is Email Format Valid

License

Open Source License

Declaration

public static boolean isEmailFormatValid(String emailAddress) 

Method Source Code

//package com.java2s;

import java.util.regex.Pattern;

public class Main {
    /**//from  w ww .ja v  a  2s .com
     * Checks if is email format valid.
     *
     * @param emailAddress the email address
     * @return true, if is email format valid
     */
    private static final Pattern emailPattern = Pattern.compile("^([a-zA-Z0-9_\\-\\.]+)(@[a-zA-Z0-9_\\-\\.]+)$");

    public static boolean isEmailFormatValid(String emailAddress) {
        if (emailAddress == null || emailAddress.trim().length() == 0)
            throw new IllegalArgumentException("Do not empty email address to this method.");

        return emailPattern.matcher(emailAddress).matches();
    }
}

Related

  1. isEmail(String value)
  2. isEmailAddress(String input)
  3. isEmailAddressFormat(String address)
  4. isEmailAddressValid(String emailAddress)
  5. isEmailer(String email)
  6. isEmailValid(String address)
  7. isEmailValid(String email)
  8. isEmailValid(String email)
  9. isEmailValid(String email)