Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isEmail(String strEmail) { if (strEmail == null || strEmail.equals("")) { return false; } String strPattern = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$"; Pattern p = Pattern.compile(strPattern); Matcher m = p.matcher(strEmail); return m.matches(); } }