0% found this document useful (0 votes)
17 views1 page

Email Validate

The document contains a JavaScript regular expression to validate an email address. It defines a regular expression to check the format of an email, and uses it to test a sample email, alerting whether it is valid or invalid.

Uploaded by

Arya M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views1 page

Email Validate

The document contains a JavaScript regular expression to validate an email address. It defines a regular expression to check the format of an email, and uses it to test a sample email, alerting whether it is valid or invalid.

Uploaded by

Arya M
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

<html>

<head>

<title>JavaScript Regular expression to valid an email address</title>

</head>

<body>

<script>

function valid_email(str)

var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;

if(mailformat.test(str))

alert("Valid email address!");

else

alert("You have entered an invalid email address!");

valid_email("[email protected]");

</script>

</body>

</html>

You might also like