Here you can find the source of isValidEmail(String email)
Parameter | Description |
---|---|
a parameter |
public static boolean isValidEmail(String email)
//package com.java2s; //License from project: Apache License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { /**//from w w w .j a v a2 s.c o m * Validate if the email is valid. * * @param email * @return true: it is valid. Otherwise, it is invalid. */ public static boolean isValidEmail(String email) { String check = "[a-zA-Z0-9\\+\\.\\_\\%\\-\\+]{1,256}" + "\\@" + "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" + "(" + "\\." + "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" + ")+"; Pattern pattern = Pattern.compile(check); Matcher matcher = pattern.matcher(email); return matcher.matches(); } }