Wednesday, February 07, 2007

Form input validation: selective service

I while ago I attempted to locate any information on the selective service number and means of simple validation of selective service numbers collected through the Internet. The answer I received from Public and Intergovernmental Affairs at the Selective Service System was:

The first two digits of a man's Registration Number, who was born January 1, 1960, or later, will be his year of birth (such as 78, 80, 84, etc.), followed by a dash and eight other digits, making ten digits total. These last remaining eight digits are just random numbers (84-XXXXXXX-X).

Like the social security number there are no check digits hidden in the number (so, no code). To do client-side Javascript validation the appropriate regular expression would be: /^(\d{2})-?(\d{7})-?(\d)$/; or /^\d{2}-?\d{7}-?\d$/; if you didn't feel like saving components in an array.

I just love going through old mail messages :D

No comments: