Validate a DVA File number using a regular expression

Posted on
regex dva medicare

I’ve been working on DVA (Australia’s Department of Veterans' Affairs) number validation recently and couldn’t find a working regular expression.

This post by (I think) Mike Squires has the basics right but this expression can’t handle the space as the War code. It also isn’t handling the last optional letter for dependents.

So I came up with the updated version:


I’m a n00b with regex but I think this one is pretty close (associated with a length 3 to 9 check on the string, of course)

Hit me on twitter if you know of a better way!