Java Email Validate isEmail(final String text)

Here you can find the source of isEmail(final String text)

Description

Validates that is an email

License

Open Source License

Parameter

Parameter Description
text text to validate that is an email

Return

true valid text, false invalid text

Declaration

public static boolean isEmail(final String text) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";

    /**//  w w w . ja v  a 2 s. com
     * Validates that is an email
     *
     * @param text text to validate that is an email
     * @return true valid text, false invalid text
     */
    public static boolean isEmail(final String text) {
        Matcher matcher = Pattern.compile(EMAIL_PATTERN).matcher(text);
        return matcher.matches();
    }
}

Related

  1. getSmtpPort(String email)
  2. isEmail(CharSequence email)
  3. isEmail(CharSequence input)
  4. isEmail(final String email)
  5. isEmail(final String s)
  6. isEmail(String correo)
  7. isEmail(String data)
  8. isEmail(String email)
  9. isEmail(String email)