in reply to Drop middle part in a substitution

s/[^\.]*(?=(?:jpg|gif|txt)$)//;
Boris