Java Email Validate isValidEmailAddress(String emailAddress)

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

Description

is Valid Email Address

License

Open Source License

Declaration

public static boolean isValidEmailAddress(String emailAddress) 

Method Source Code

//package com.java2s;
/*/*from w w  w  .j  a v  a  2  s . c  o  m*/
 * This file is part of SimpleClans2 (2012).
 *
 *     SimpleClans2 is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     SimpleClans2 is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with SimpleClans2.  If not, see <http://www.gnu.org/licenses/>.
 *
 *     Last modified: 10.10.12 21:57
 */

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

public class Main {
    public static boolean isValidEmailAddress(String emailAddress) {
        if (emailAddress == null) {
            return false;
        }
        String expression = "^[\\w\\-]([\\.\\w\\-])+[\\w]+@([\\w\\-]+\\.)+[A-Z]{2,4}$";
        Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
        Matcher matcher = pattern.matcher(emailAddress);
        return matcher.matches();
    }
}

Related

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