I'm using a reactive form to get user input. Not satisfied with the EmailValidator I'm using a pattern. 
emailRegEx = '^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$';
this.email = new FormControl('', [Validators.required, Validators.pattern(emailRegEx)]);
And the HTML:
<input type="email" formControlName="email" [ngClass]="contactForm.get('email').errors && (contactForm.get('email').dirty || isButtonClicked) ? 'contact-input input-error' : 'contact-input'">
But here's the thing, for some reason the regex is accepting 4 chars after the @, without a period.
name@d --> error
name@doma --> no error
name@domain. --> error
name@domain.com --> no error
I checked this regex in multiple online regex testers, and they all only accept the last example above, none of them accept the second one.
EDIT:
The regular expression is fine and works well, the problem is that somehow the pattern validator isn't parsing the regex correctly, or something.
 
     
     
     
     
    