Given lines that look like the following:
Blah \cite[9.1173]{Joyce:1986aa}\autocite[42]{Kenner:1970ab}\autocite[108]{Hall:1960aa} bbb.\n
I’d like to remove the second (and any subsequent) occurrence of \autocite
, resulting in the following:
Blah \autocite[9.1173]{Joyce:1986aa}[42]{Kenner:1970ab}[108]{Hall:1960aa} bbb.\n
I’m struggling to express this in regex form (I’m using the python 2.7 RE module), however, as I’m not sure how to formulate
“remove only the second and subsequent occurrences of \autocite
when followed by […]{…}
, until a space or period is encountered”.