I have the following code as part of my email validation script. I'd like to learn more about the variable reg
but don't know how to find relevant information because I do not know what the syntax is called. Could someone direct me to the proper resource or tell me the name of this type of syntax?
function validate(form_id,email) {
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var address = document.forms[form_id].elements[email].value;
if(reg.test(address) == false) {
alert('Invalid Email Address');
return false;
}
}