Skip to main content
additional check
Source Link
Rajeshwar
  • 2.4k
  • 4
  • 33
  • 47

Wow, there are lots of complexity here. If all you want to do is just catch the most obvious syntax errors, I would do something like this:

^\S+@\S+$

It usually catches the most obvious errors that the user makes and assures that the form is mostly right, which is what JavaScript validation is all about.

EDIT: We can also check for '.' in the email using

/^\S+@\S+\.\S+$/

Wow, there are lots of complexity here. If all you want to do is just catch the most obvious syntax errors, I would do something like this:

^\S+@\S+$

It usually catches the most obvious errors that the user makes and assures that the form is mostly right, which is what JavaScript validation is all about.

Wow, there are lots of complexity here. If all you want to do is just catch the most obvious syntax errors, I would do something like this:

^\S+@\S+$

It usually catches the most obvious errors that the user makes and assures that the form is mostly right, which is what JavaScript validation is all about.

EDIT: We can also check for '.' in the email using

/^\S+@\S+\.\S+$/
add start and end checks since otherwise, the pattern is pretty useless in most use cases that I can think of. And it's going to confuse most people I think.
Source Link
Romain Vincent
  • 3.3k
  • 2
  • 24
  • 30

Wow, there are lots of complexity here. If all you want to do is just catch the most obvious syntax errors, I would do something like this:

\S+@\S+^\S+@\S+$

It usually catches the most obvious errors that the user makes and assures that the form is mostly right, which is what JavaScript validation is all about.

Wow, there are lots of complexity here. If all you want to do is just catch the most obvious syntax errors, I would do something like this:

\S+@\S+

It usually catches the most obvious errors that the user makes and assures that the form is mostly right, which is what JavaScript validation is all about.

Wow, there are lots of complexity here. If all you want to do is just catch the most obvious syntax errors, I would do something like this:

^\S+@\S+$

It usually catches the most obvious errors that the user makes and assures that the form is mostly right, which is what JavaScript validation is all about.

Post Made Community Wiki by pera
Copy edited.
Source Link
Peter Mortensen
  • 31.3k
  • 22
  • 109
  • 132

Wow, there are lots of complexity here, if. If all you want to do is just catch the most obvious syntax errors, I would do something like this:

\S+@\S+

It usually catches the most obvious errors that the user makes and assures that the form is mostly right, which is what javascriptJavaScript validation is all about.

Wow, lots of complexity here, if all you want to do is just catch the most obvious syntax errors, I would do something like this:

\S+@\S+

It usually catches the most obvious errors that the user makes and assures that the form is mostly right, which is what javascript validation is all about.

Wow, there are lots of complexity here. If all you want to do is just catch the most obvious syntax errors, I would do something like this:

\S+@\S+

It usually catches the most obvious errors that the user makes and assures that the form is mostly right, which is what JavaScript validation is all about.

Fixed formatting.
Source Link
user212218
user212218
Loading
Source Link
Jaymon
  • 5.6k
  • 3
  • 36
  • 35
Loading