Here you can find the source of isLegarEmail(String email)
public static boolean isLegarEmail(String email)
//package com.java2s; /**//ww w .j a v a2 s . c o m * * Methods Descrip:Converts a line of text into an array of lower case words * using a BreakIterator.wordInstance(). * <p> * * This method is under the Jive Open Source Software License and was * written by Mark Imbriaco. * * @param text * a String of text to convert into an array of words * @return text broken up into an array of words. * */ import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isLegarEmail(String email) { boolean flag = false; // Pattern p = // Pattern.compile("[A-Za-z0-9]*@[A-Za-z0-9]+([.|-][A-Za-z0-9]+)*[.][A-Za-z0-9]+$"); Pattern p = Pattern.compile("^\\w[-._\\w]*\\w@\\w[-._\\w]*\\w\\.\\w{2,6}$"); Matcher m = p.matcher(email); flag = m.matches(); return flag; } }