0

I want to validate a form input with an email address. I already have a RegEx for checking that it ends with certain suffixes (^.+@((gmail\.com)|(hotmail\.fr))$). Now, I would like to validate the opposite.

How can I match an email address that does not end with certain suffixes with a RegEx?

Edit: I'm using jQuery validate with unobtrusive validation, e.g.:

<input id="auth_email" name="auth_email" type="email" 
       data-rule-pattern="^.+@((gmail\.com)|(hotmail\.fr))$"
       data-msg-pattern="The email address must not end with '@gmail.com' or '@hotmail.fr'"
       class="form-control" required  data-lpignore="true">

I would really prefer a pure RegEx solution.

Julien Poulin
  • 12,737
  • 10
  • 51
  • 76

0 Answers0