We have different regular expression patterns for validating email address.In this article, I am sharing some useful cross browsers regular expression patterns for validating email address with java script and jquery.The script makes the following assumptions regarding what a valid email address is: -Contains a least one character procedding the "@" -Contains a "@" following the procedding character(s) -Contains at least one character following the "@", followed by a dot (.), followed by either a two character or three character string (a two character country code or the standard three character US code, such as com, edu etc) Note that this script requires NS 4 or IE 4 to function- all other browsers will simply not participate in the form validation process.Example: Directions: Simply cut and paste the below code into the section of your page.Though this solution may be simple, I'm sure this is one of those useful things that people will be Googling for and deserves its own entry on the site If only Google would be the first place to look :) Just look at the duplicates of this closed every some time.
If not, the form submition is canceled, and the surfer prompted to re-enter a valid address.Here's an example of the above in action: Almost all answers to this questions suggest using Regex to validate emails addresses.I think Regex is only good for a rudimentary validation.To get a valid email id we use a regular expression /^\w ([\.-]? ~ characters are legal in the local part of an e-mail address but in the above regular expression those characters are filtered out. It begins with at least one or more word characters including the underscore, equivalent to [A-Za-z0-9_].