Better extension matching

Allows more than one segment in the extension, and accurate matching against
files that have multiple extension segments. As an example, I tried the package
name "apigility.org.zpk", and the tool raised an error about being unable to
recognize the file format. The changes in this patch allow that to work.