I read about regexps, decided to bungle one to check whether this string is an email. It seems like it should work, but no.
Scanner s = new Scanner(System.in); while(true){ System.out.println("Input a valid email address."); Pattern email = Pattern.compile("([az[AZ]])+@([az[AZ]])+\Q.\E([az[AZ]])+"); Matcher matcher = email.matcher(s.nextLine()); if(matcher.matches()){ System.out.println("Valid"); }else System.out.println("Invalid"); } For all requests gives Invalid.