SoFunction
Updated on 2025-02-28

JS code to verify whether the mailbox format is correct


/*
*Verify that the email format is correct
* Parameter strEmail, mailbox that needs to be verified
*/
function chkEmail(strEmail) {
if (!/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(strEmail)) {
return false;
}
else {
return true;
}
}