This script is executed when you press the button: function checkMail() { var x = document.forms[0].email.value; var filter = /^([a-zA-Z0-9_.-])+ @(([a-zA-Z0-9-])+.)+ ([a-zA-Z0-9]{2,4})+$/; if (filter.test(x)) alert(‘YES! Correct email address’); else a alert(‘NO! Incorrect email address’); } Explanation First take the data function checkMail() { var x = document.forms[0].email.value; The regular expression Then define the regular [...]