well there are plenty examples on the net such this from
http://www.breakingpar.com/bkp/home.nsf/0/87256B280015193F87256F6A0072B54C[
^]
function isValidSSN(value) {
var re = /^([0-6]\d{2}|7[0-6]\d|77[0-2])([ \-]?)(\d{2})\2(\d{4})$/;
if (!re.test(value)) { return false; }
var temp = value;
if (value.indexOf("-") != -1) { temp = (value.split("-")).join(""); }
if (value.indexOf(" ") != -1) { temp = (value.split(" ")).join(""); }
if (temp.substring(0, 3) == "000") { return false; }
if (temp.substring(3, 5) == "00") { return false; }
if (temp.substring(5, 9) == "0000") { return false; }
return true;
}
and this from
http://www.learn-javascript-tutorial.com/RegularExpressions.cfm[
^]
var RE_SSN = /^[0-9]{3}[\- ]?[0-9]{2}[\- ]?[0-9]{4}$/;
function checkSsn(ssn){
if (RE_SSN.test(ssn)) {
alert("VALID SSN");
} else {
alert("INVALID SSN");
}
}