Java Email Validate isEmail(String emailAddress)

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

Description

is Email

License

Apache License

Declaration

public static boolean isEmail(String emailAddress) 

Method Source Code

//package com.java2s;
/**/*ww  w . j  a v a2  s .c o  m*/
 * Copyright (C) 2012 KRM Associates, Inc. healtheme@krminc.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

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

public class Main {
    public static boolean isEmail(String emailAddress) {
        final String EMAIL_REGEX = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$";
        Pattern pattern = Pattern.compile(EMAIL_REGEX);
        Matcher matcher = pattern.matcher(emailAddress);
        return matcher.find();
    }
}

Related

  1. isEmail(String email)
  2. isEmail(String email)
  3. isEmail(String email)
  4. isEmail(String email)
  5. isEmail(String email)
  6. isEmail(String input)
  7. isEmail(String msg)
  8. isEmail(String s)
  9. isEmail(String str)