title: Email verification in java
body: <p>Is there any regex to validate email which disallow <code>.com.com</code> i.e example@example.com.com but allow <code>.com.uk</code>?
  I have pasted my code that should return false while user enters <code>.com.com</code>. Can anyone verify my code below?</p>
  
  <pre><code>String ePattern = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@" + "[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
  Pattern p =Pattern.compile(ePattern);
  Matcher m = p.matcher(studentemail);
  b= m.matches();
      if(!b) {
          eMsg.addError("email must be in formate: example@example.xxx / example@example.xx");
          request.setAttribute("errorMessage", eMsg);
          requestDispatcher = request.getRequestDispatcher("/addrecord.jsp");
          requestDispatcher.forward(request, response);
          return;
      }   
  
       else {
             System.out.println("valid email id");
        } 
  </code></pre>