<human>:  How to find and replace nth occurence of word in a sentence using python regular expression?
<bot>: Here is some code to find and replace 2nd occurrence of word 'cat' by 'Bull' in a sentence 's'

re.sub('^((.*?cat.*?){1})cat', '\\1Bull', s)

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