Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isEmail(String strEmail) { String EMAIL_PATTERN = "^[a-zA-Z0-9_-][\\w\\.-]*[a-zA-Z0-9_-]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$"; Pattern p = Pattern.compile(EMAIL_PATTERN); Matcher m = p.matcher(strEmail); return m.matches(); } }