$filename =~ s/^(.{7})(?=[^.]{2,}.*(\.[^.]+)?$)/$1~$2/;