A regular expression that accurately matches the valid SSN (Social Security Number) number.
/^(?!666|000|9\\d{2})\\d{3}-(?!00)\\d{2}-(?!0{4})\\d{4}$/
Where:
(?!666|000|9\\d{2})\\d{3}represents the first 3 digits should not start with000,666, or between900and999.(?!00)\\d{2}represents the next 2 digits should not start with00and it should be any from01-99.(?!0{4})\\d{4}represents the next 4 digits can’t0000and it should be any from0001-9999.
SSN Number Examples:
- 123-33-0002
- 231-22-1234
- 321-66-4321