Human: rreplace - How to replace the last occurence of an expression in a string? Assistant: 
Here is some code to replace the last occurence of an expression '</div>' with '</bad>' in a string `s`

re.sub('(.*)</div>', '\\1</bad>', s)

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