Given the string:
X did something. X found it to be good, and so X went home.
I would like to replace all occurrences of X but the first one, with Y, such that the output string would look like:
X did something. Y found it to be good, and so Y went home.
I tried many regex patterns (based on https://vi.stackexchange.com/questions/10905/substitution-how-to-ignore-the-nth-first-occurrences-of-a-pattern) but failed to implement this with Python