Skip to main content
deleted 4 characters in body
Source Link
turivishal
  • 35.6k
  • 7
  • 42
  • 64

Wow, there are a lot of answers that contain slightly different regular expressions. I've tried some many that I've got different results and a variety of different issues with all of them.

For UI validation, I'm good with the most basic check of looking for an @ sign. It's important to note, that I always do server-side validation with a standard "validate email" that contains a unique link for the user to confirm their email address.

if (email.indexOf('@') > 0)

I have purposely chosen 0 even with zero-based as it also ensures there is a single character before the @.

Wow there are a lot of answers that contain slightly different regular expressions. I've tried some many that I've got different results and a variety of different issues with all of them.

For UI validation, I'm good with the most basic check of looking for an @ sign. It's important to note, that I always do server-side validation with a standard "validate email" that contains a unique link for the user to confirm their email address.

if (email.indexOf('@') > 0)

I have purposely chosen 0 even with zero-based as it also ensures there is a single character before the @.

Wow, there are a lot of answers that contain slightly different regular expressions. I've tried many that I've got different results and a variety of different issues with all of them.

For UI validation, I'm good with the most basic check of looking for an @ sign. It's important to note, that I always do server-side validation with a standard "validate email" that contains a unique link for the user to confirm their email address.

if (email.indexOf('@') > 0)

I have purposely chosen 0 even with zero-based as it also ensures there is a single character before the @.

Source Link
endyourif
  • 2.2k
  • 19
  • 33

Wow there are a lot of answers that contain slightly different regular expressions. I've tried some many that I've got different results and a variety of different issues with all of them.

For UI validation, I'm good with the most basic check of looking for an @ sign. It's important to note, that I always do server-side validation with a standard "validate email" that contains a unique link for the user to confirm their email address.

if (email.indexOf('@') > 0)

I have purposely chosen 0 even with zero-based as it also ensures there is a single character before the @.

Post Made Community Wiki by endyourif