Here you can find the source of validEmail(String email)
Parameter | Description |
---|---|
the email |
public static boolean validEmail(String email)
//package com.java2s; //License from project: Apache License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { /** The Constant VALID_EMAIL_PATTERN. */ private static final String VALID_EMAIL_PATTERN = "^[\\w\\.=-]+@[\\w\\.-]+\\.[\\w]{2,5}$"; /**//from w w w . j a va 2s. c o m * Valid email. * * @param email the email * @return true, if successful */ public static boolean validEmail(String email) { Pattern pattern = Pattern.compile(VALID_EMAIL_PATTERN); Matcher matcher = pattern.matcher(email); return matcher.find(); } }