Archive for the ‘Regular Expression’ Category

Email Checking using RegExpression

March 2, 2008

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 [...]

Follow

Get every new post delivered to your Inbox.