Can someone provide me a regex for SSN that matches either
123-45-6789
OR
XXX-XX-XXXX
I currently have ^\\d{3}-?\\d{2}-?\\d{4}$
Then it can be
/^[\dX]{3}-?[\dX]{2}-?[\dX]{4}$/
if you want x to be valid too, you can add the i modifier to the end:
/^[\dX]{3}-?[\dX]{2}-?[\dX]{4}$/i
On second thought, the regex above will accept
123-xx-xxxx
as well, so depending on whether you want this form to be accepted or not, you can use your original form "or" the other form:
/^(\d{3}-?\d{2}-?\d{4})|(xxx-xx-xxxx)$/i