//indian landline number
function isValidIndianLandLineNumber(phoneNo) {
var pattern = /^\d{2}-\d{4}-\d{6}$/;
return pattern.test(phoneNo);
}
//indian cell phone number
function isValidIndianCellNumber(phoneNo) {
var pattern = /^\d{2}-\d{10}$/;
return pattern.test(phoneNo);
}
//indian pan card number
function isValidIndianPanNumber(val, lastName) {
var lastChar = lastName[0].toUpperCase();
var pattern =
"^[A-Z]{3}(A|B|C|F|G|H|L|J|P|T)[" + lastChar + "]{1}[0-9]{4}[A-Z]{1}$";
var RegExpObj = new RegExp(pattern);
return RegExpObj.test(val);
}
//indian adhaar card number
function isValidIndianAdhaarCard(adhaarCardNumber) {
var pattern = /^[0-9]{4}-[0-9]{4}-[0-9]{4}$/;
return pattern.test(adhaarCardNumber);
}
//Indian Eleection card number
function isValidIndianElectionCard(val) {
var pattern = "^[A-Z]{3}[0-9]{7}$";
var RegExpObj = new RegExp(pattern);
return RegExpObj.test(val);
}
console.log(isValidIndianLandLineNumber("91-2367-233427"));
console.log(isValidIndianCellNumber("91-9890868345"));
console.log(isValidIndianPanNumber("ASPPD8644J", "DESAI"));
console.log(isValidIndianAdhaarCard("5420-2651-7427"));
console.log("RESULT:",isValidIndianElectionCard("NWH1662832"))
No comments:
Post a Comment