Handle bad version numbers gracefully

Pre-compile the regexp for a valid version number, and check
args[0] against it before it fails later in vercmp().  Note that
we could easily use .match() instead of .search(), since the regexp
has a start-of-line anchor in it, but this is a bit more verbose.