Here you can find the source of isEmail(String msg)
public static boolean isEmail(String msg)
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isEmail(String msg) { Pattern pattern = Pattern .compile("^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"); Matcher matcher = pattern.matcher(msg); return matcher.matches(); }/*from w w w . j av a 2 s . co m*/ }