Email address syntax validation? Let the browser do it (without regexp)

Here is a simple and robust way to check for the validity of an email address syntax directly in the browser. No need for crazy regular expressions.

e = document.createElement('input')
e.type = 'email'
// Let's check some email addresses:
e.value = 'hi@'
e.validity.valid
// false
e.value = 'hi@fullweb.io'
e.validity.valid
//true

You can go further and explore the HTML5 email input element for more functionality, using the pattern attribute for a custom regexp, checking for too long/short or empty value and more.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.