I made .edu email validation using this method - jQuery Form Validation, Only Allow .EDU Email Addresses
But instead of just .edu or just .edu.nn (where nn is a 2-digit country code), I would like to include both in one. Can't figure out how to achieve that. Below is the code that accepts both .edu and .edu.fr - I need to accept all other 2-digit country codes in addition to .edu
Thank you for your help!
$.validator.addMethod("edu", function (value, element, param) {
// Make it work optionally OR
// Check the last 4 and 7 characters and ensure they match .edu and .edu.2-digit-country-code
return (this.optional(element) || value.slice(-4) == ".edu" || value.slice(-7) == ".edu.fr");
}, "Please enter valid .edu email address");
$("#requestform").validate({
rules: {
email: {
required: true,
email: true,
edu: true
},
}
});