Often, email validation code for web applications checks only for the position of @ and period characters, also assuming the @ character will be in the front of period. Did you know you can use a Java Script Regular Expressions method to check email addresses? A while ago I put up a Password Strength Checker using Java Script and Regular Expressions.Example: Directions: Simply cut and paste the below code into the section of your page.It contains a form with one box that is checked for "email validity".Here's an example of the above in action: Maybe if you added an explanation or description to go with it?
//reported to validate incorrectly: [email protected] as true /[A-Z0-9._% -] @[A-Z0-9-] . An innate tendency to channel a mythical creature (ahem, unicorn)? Discover the top traits of the most successful CTOs in this free guide.
Would you like to answer one of these unanswered questions instead?
Description: A script that closely examines the content of a form box to ensure that the user entered a valid email address.
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.
But keep in mind that one should not rely only upon Java Script validation. This should be validated on the server side as well.If you reduce your answer to just the jacascript, and add a little blurb to go with it, I'll give you an upvote. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).