views:

29

answers:

1

I'm developing an online form in which user-entered Medicare numbers will need to be validated.

(My specific problem concerns Australian Medicare numbers, but I'm happy for answers regarding American ones too. This question is about Medicare numbers in general.)

So how should I do it?

(It would be good to have the answer in Javascript or a regex.)

A: 

I found a forum discussion on the topic:

http://regexadvice.com/forums/thread/57337.aspx

I'm going to try the one 'Aussie Susan' came up with:

^\d{9}B[ADGHJKLNPQRTWY1-9,]?$
jonathanconway