Ok. Thanks @Aran-Fey. On a related note, I was expecting this regex to replace the first occurrence of Damayanti in the string, but it didn't. Can you explain what's wrong with the regex?
In [33]: re.sub(r"([^{]Damayanti)", r"\\texttt{\1}", x)
Out[33]: "Damayanti\\texttt{ Damayanti}'s \\texttt{Damayanti}"