Validating the email
The field under validation must end with one of the given values.
Not only will we use regexes to do the validation but we’ll cover some other strategies.
It is incredibly difficult to build a good regex to handle all the validation scenarios.
For example, these are all valid email addresses: So you should decide how restrictive you need to be in your matching.
If this is for a user signing up on your website and if you’re going to email them a validation code then you might not need to be too strict. The @ sign is a super simple way to do some easy validation. But you could also throw in some length validation as well which is discussed below. This regex ensures the user typed at least one character before the @ and one after. @won’t match it but it will match most email addresses.
If someone types an @ symbol sometimes that’s good enough. This will match every one of the examples up above and is fast. You could use it but why risk having a valid email address be rejected. Here is some data on what we’ve seen for email address lengths for real people when parsing emails: If you built your email validation rule to validate that an email address is at least 7 characters, that would be a pretty good rule.
If you don't have the proper application template, you could be hindering your ability to get tasks done or collect the information you need.