programming-examples/js/Vre1/Check whether a given value is a social security number or not .js

17 lines
483 B
JavaScript
Raw Normal View History

2019-11-15 12:59:38 +01:00
function is_socialSecurity_Number(str)
{
regexp = /^(?!000|666)[0-8][0-9]{2}-(?!00)[0-9]{2}-(?!0000)[0-9]{4}$/;
if (regexp.test(str))
{
return true;
}
else
{
return false;
}
}
console.log(is_socialSecurity_Number("019-90-5680"));
console.log(is_socialSecurity_Number("K8V-3Y1"));