14 lines
320 B
JavaScript
14 lines
320 B
JavaScript
function valid_email(str)
|
|
{
|
|
var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
|
|
if(mailformat.test(str))
|
|
{
|
|
console.log("Valid email address!");
|
|
}
|
|
else
|
|
{
|
|
console.log("You have entered an invalid email address!");
|
|
}
|
|
}
|
|
|
|
valid_email('me-info@example.com');
|