Java Email Validate isValidEmailAddress(String email)

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

Description

Checks if whether or not an email address is Valid.

License

Open Source License

Parameter

Parameter Description

Return

true or false.

Declaration

public static final boolean isValidEmailAddress(String email) 

Method Source Code

//package com.java2s;
/*/*  ww w.  j a v  a 2s  .c o m*/
 * Copyright (c)  Sofun Gaming SAS.
 * Copyright (c)  Julien Anguenot <julien@anguenot.org>
 * Copyright (c)  Julien De Preaumont <juliendepreaumont@gmail.com>
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Julien Anguenot <julien@anguenot.org> - initial API and implementation
*/

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

public class Main {
    /**
     * Checks if whether or not an email address is Valid.
     * 
     * @param email: an email address as {@link String}
     * @return true or false.
     */
    public static final boolean isValidEmailAddress(String email) {
        final String expression = "^[\\w\\-]([\\.\\w])+[\\w]+@([\\w\\-]+\\.)+[A-Z]{2,4}$";
        final CharSequence inputStr = email;
        final Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
        final Matcher matcher = pattern.matcher(inputStr);
        return matcher.matches();
    }
}

Related

  1. isValidEmail(String eMailAddress)
  2. IsValidEmail(String input)
  3. isValidEmailAddr(String str)
  4. isValidEmailAddress(String addr)
  5. isValidEmailAddress(String aEmailAddress)
  6. isValidEmailAddress(String email)
  7. isValidEmailAddress(String email)
  8. isValidEmailAddress(String email)
  9. isValidEmailAddress(String email)