I am making an Email Parser program.
The email should follow following rules:
• The prefix or the user-id (i.e. the characters before @) should contain at least 6 and maximum of 15 characters. • The domain name (i.e. the characters after @ and before dot) should contain at least 3 and maximum of 8 characters. • The extension (i.e. the characters after dot) must contain exactly 3 characters. • The extension must be one of the following three types: com, org and edu.

Pattern p = Pattern.compile("[@.]{6,15}@\\w{3,8}\\.(com|org|edu)$");

Is the above code line correct? As on every input the message for invalid email is occuring.. Thanks

I haven't check your pattern but I know following is working :)