<human>:  How to replace only part of the match with python re.sub
<bot>:*)$', '_suff.\\2', 'long.file.name.jpg')

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.