0

I'm working on a contact form, in the email input field I need to make sure that the user is inputting a correct email address.

I've only found regex that validate the below: email@domain (without the .com,.net, .info, etc)

What regex requires the user to enter the .com, .net, etc?

Regex I've used:

\b[A-Z0-9._%+-]+@@[A-Z0-9.-]+\.[A-Z]{2,6}\b

^[A-Z0-9][A-Z0-9._%+-]{0,63}@@(?:(?=[A-Z0-9-]{1,63}\.)[A-Z0-9]+(?:-[A-Z0-9]+)*\.){1,8}[A-Z]{2,63}$

^(?=[A-Z0-9@@._%+-]{6,254}$)[A-Z0-9._%+-]{1,64}@@(?:[A-Z0-9-]{1,63}\.){1,8}[A-Z]{2,63}$

^[A-Z0-9._%+-]{1,64}@@(?:[A-Z0-9-]{1,63}\.){1,125}[A-Z]{2,63}$
Adriaan
  • 17,741
  • 7
  • 42
  • 75
guezjs
  • 13
  • 1
  • 5

1 Answers1

0

In regex a . is used to match any character. Escaping the dot as such; \. will allow you to match it.

So I guess something like (assuming the beginning already works) could work:

\..{3,6}
L.Renaud
  • 1
  • 1