You didn't specify the environement, but I think that it is safe to assume that you have regex on hand. Thus - also assuming that expected extensions are from a finite set - I would create a list of possible extensions and use regex to separate names from extensions.
On this sample set we have tar, tar.gz and zip extensions.
first.tar
second.file.tar
third.tar.gz
fourth.zip
fifth.stuff.zip
Using this Python regex '^(.*)\.(tar|tar\.gz|zip)$'gim you can have the file name in the first capture group and the extension in the second. When you process one filename at once, then m switch (multiline) can be omitted.
Is that something you wanted?