Improved regex for filename matching