Here you can find the source of isValidEmail(String email)
Parameter | Description |
---|---|
String |
public static boolean isValidEmail(String email)
//package com.java2s; //License from project: Apache License import java.util.regex.Pattern; public class Main { private static final Pattern VALID_EMAIL_REGEX_PATTERN = Pattern .compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE); /**/*from w w w . j a va2 s. co m*/ * To check the passed email is valid or not. * * @param email String * @return TRUE on valid email, false otherwise. */ public static boolean isValidEmail(String email) { final boolean isValidEmail = VALID_EMAIL_REGEX_PATTERN.matcher( email).matches(); if (!isValidEmail) { System.out.println("Invalid email : " + email); } return isValidEmail; } }