Here you can find the source of isEmail(final String text)
Parameter | Description |
---|---|
text | text to validate that is an email |
public static boolean isEmail(final String text)
//package com.java2s; //License from project: Open Source License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { private static final String EMAIL_PATTERN = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; /**// w w w . ja v a 2 s. com * Validates that is an email * * @param text text to validate that is an email * @return true valid text, false invalid text */ public static boolean isEmail(final String text) { Matcher matcher = Pattern.compile(EMAIL_PATTERN).matcher(text); return matcher.matches(); } }