Java tutorial
//package com.java2s; //License from project: Apache License import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isEmailValid(String email) { if (isEmpty(email)) { return false; } String regex = "[\\w!#$%&'*+/=?^_`{|}~-]+(?:\\.[\\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\\w](?:[\\w-]*[\\w])?\\.)+[\\w](?:[\\w-]*[\\w])?"; Pattern p = Pattern.compile(regex); Matcher matcher = p.matcher(email); return matcher.matches(); } public static boolean isEmpty(CharSequence str) { return (str == null || str.length() == 0); } }