Checking an email address - Version 01 : EMail « Regular Expressions « JavaScript Tutorial






<html>
<head>
<title>Checking an email address - Version 01</title>
<script type="text/javascript" language="javascript">
<!-- //
function IsMatchingAddress(str){
    var myRegExp = /[a-z0-9-]{1,30}@[a-z0-9-]{1,65}.[a-z]{3}/ ;
    return myRegExp.test(str)
}

function TestGuess(){

var EmailAddr = "asdf@asdf.net".toLowerCase();
alert(IsMatchingAddress(EmailAddr));
}
// -->
</script>
</head>
<body>
<h3>This page allows you to enter and check
 an email address such as asdf@java2s.com.com</h3>
<form>
<button type="Button" onclick="TestGuess()">
Click here to enter email address</button>
</form>
</body>
</html>








26.4.EMail
26.4.1.Checking an email address - Version 01
26.4.2.Checking an email address - Version 02
26.4.3.Use Regular expression to validate the Email