We can validate email address at client side and server side.To validate email address on client side, we can use java script with regular expression.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.Validating email address using regular expressions is tricky and is often not recommended. A valid email address as defined by RFC 2822 can be quite complex.A valid email is of the format: [email protected] The name can be a set of ‘atoms’ separated by dots. single or double quotes and any character inside the quotes Now, to the domain part. MUSEUM .travel, .international or even .vermögensberatung For example all the following email addresses are valid: Source The sad truth is that despite the complex regular expression validation, the email may not be existing, so can still be invalid for practical purposes.In this page we have discussed how to validate an email using Java Script : An email is a string (a subset of ASCII characters) separated into two parts by @ symbol. a "personal_info" and a domain, that is [email protected] The length of the personal_info part may be up to 64 characters long and domain name may be up to 253 characters. The personal_info part contains the following ASCII characters.
Any code can be removed without warning (if it is deemed offensive, damaging or for any other reason).This is building on my previous post on how to use regular expressions with j Query. Update 12/05/13: Separated into versions for testing.//reported to validate incorrectly: [email protected] as true /[A-Z0-9._% -] @[A-Z0-9-] .I'm tired of being told my e-mail address of "foo [email protected]" is invalid.The best option is to ask the user to type their e-mail in twice and if you MUST use a regex checker, then tell the user that their e-mail address does not appear to be valid and ask if they are sure they typed it right.
To get a valid email id we use a regular expression /^\w ([\.-]?