Regexp pattern accepted by --exclude option

This builds on the patch from @notdavelane; I've needed to use regexps for excluding files rather than just simple substrings.

Probably want to pull in the simplification from @victorpoluceno as well.