Here you can find the source of isValidEmail(String email)
Parameter | Description |
---|---|
the email to validate |
public static boolean isValidEmail(String email)
//package com.java2s; //License from project: Open Source License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { /**// ww w . j a va 2 s. c o m * Validate if the given value is a valid Email address. * * @param email * the email to validate * @return <ii>true</ii> if the provided value is a valid Email, <ii>false</ii> otherwise */ public static boolean isValidEmail(String email) { if (email == null) { return false; } Pattern p = Pattern.compile(".+@.+\\.[a-z]+"); Matcher m = p.matcher(email); return m.matches(); } }