How do I make a pattern for an email address that is only valid if it contains at least one character, followed by an @ sign, followed by at least one character, followed by a period (.) followed by at least “co”. (So, “[email protected]” is an example of the “least valid” email address)
1 Answer
You will need to use regex to validate the email address. I suggest you look here if you don't know about regular expressions. The expression for validating an email is this:
/^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4}$/
You will have to validate it using JavaScript regex. Check that out here.