26
Views
4
Comments
How to Valided SSN number
Question

I'm validating SSN numbers with the format***-**-**** . If the user enters all the same digits (e.g., 000000000 or 111111111), or if the first three digits are 000 or 999, an error will be displayed. Only hyphens are allowed as special characters." 



2019-04-09 00-57-55
carl ruhle

Hi Pratik,

starting you can use javascript regular expressions, /^\\d{3}-\\d{2}-\\d{3}$/, this will check for the right format.

For the other part, select the first 3 values and check with == if its equal or not. 

Hope it helps you, regards. 

2019-01-07 16-04-16
Siya
 
MVP

What you could do is get the substring based on "-" and compare each character of these individuals parts with the first characters and any one is different then it's a valid SSN. Attached a reference implementation assuming the string is precisely 11 characters and in the format is ***-**-****. 

SSN.oml
2023-04-16 15-25-31
Krishnanand Pathak

Hi Pratik,

Refer the below link & implement it using javascript.
https://www.geeksforgeeks.org/how-to-validate-ssn-social-security-number-using-regular-expression/


Regards
Krishnanand Pathak

2023-06-06 10-13-52
Rishabh Chawda

Hi @Pratik dhole 

I think the regular expressions provided in the link are not working properly.

I have attached the OML. I believe it is functioning properly.

Regards, 

Rishabh Chawda

SSN_Regex.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.