enhanced regex for longer extensions and more flexible base names (closes #534)