Here you can find the source of emailValidator(final String mailAddress)
Parameter | Description |
---|---|
mailAddress | represented email |
public static boolean emailValidator(final String mailAddress)
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { /**//from ww w .j a v a 2 s . c om * This method used to email validator. * * @param mailAddress * represented email * @return represented {@link Boolean} */ public static boolean emailValidator(final String mailAddress) { Pattern pattern; Matcher matcher; final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; pattern = Pattern.compile(EMAIL_PATTERN); matcher = pattern.matcher(mailAddress); return matcher.matches(); } }