Hi All
Please anyone let me know a valid javascript code for National Insurance number in CRM 2013
below is teh code but comes with error
Object doesnt support property or method match
function checkNINO (toCheck) {
//var exp1 = /^([A-CEGHJ-NOPR-TW-Z]{1}[A-CEGHJ-NPR-TW-Z]{1})([0-9]{2})([0-9]{2})([0-9]{2})([A-Z\s]{1})/i;
var exp1 = /^([A-Z]{1}[A-Z]{1})([0-9]{2})([0-9]{2})([0-9]{2})([A-Z\s]{1})/i;
var exp2 = /(^GB)|(^BG)|(^NK)|(^KN)|(^TN)|(^NT)|(^ZZ).+/i;
if (toCheck.match(exp1) && !toCheck.match(exp2)) {
var strFormated = toCheck.replace(exp1, "$1 $2 $3 $4 $5");
return strFormated.toUpperCase();
}
else {
// return false;
alert("Error: The NI Number must have the following letter/number combinations:\n\n[A-Z] = e.g. SG\n[0-9] = e.g. 56\n[0-9] = e.g. 01\n[0-9] = e.g. 16\n[A-D] = e.g. B");
}
}
Any help much appreciated
Thanks
Pradnya07