Java tutorial
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean emailFormats(String email) { if (email == null) return false; String regular = "^\\s*\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+\\s*$"; Pattern pattern = Pattern.compile(regular); Matcher matcher = pattern.matcher(email); if (!matcher.matches()) { return false; } return true; } }