title: Email address validation fails when domain name has a hyphen
body: <p>I have an email address validation regex Which I use in the code like this:</p>
  
  <pre><code>public class Test {
  
    public static void main(String[] args) {
      try {
        String lineIwant = "myname@asl.ramco-group.com";
        String emailreg = "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$";
        Boolean b = lineIwant.matches(emailreg);
  
        if (b == false) {
          System.out.println("Address is Invalid");
        }else if(b == true){
          System.out.println("Address is Valid");
        }
      } catch (Exception e) {
  
        e.printStackTrace();
        System.out.println(e.getMessage());
      }
    }
  }
  </code></pre>
  
  <p>On this specific email address in the example, the Boolean returns false while this is a valid customer email address.</p>
  
  <p>I am suspecting it is because of the hyphen between <code>ramco</code> and <code>group</code> because when I remove it the Boolean returns true.</p>
  
  <p>How can I change my regex to accommodate such an email address?</p>