programming-examples/js/Vre1/Check whether the pattern of an e-mail address matches a specific format.js
2019-11-15 12:59:38 +01:00

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');