public class Main { public static void main(String[] args) { System.out.println("isValid = " + isValidEmailAddress("user@domain.com")); } static boolean isValidEmailAddress(String email) { String EMAIL_REGEX = "^[\\w-_\\.+]*[\\w-_\\.]\\@([\\w]+\\.)+[\\w]+[\\w]$"; return email.matches(EMAIL_REGEX); } }