To preserve APA citations with regex span locks across automated rewrites, extract candidate spans in priority order from Unicode NFC text, merge overlapping half-open intervals before substituting placeholders, and verify restored outputs against SHA-256 digests with fail-closed rollback. Sequential re.sub() placeholder scripts break as soon as a parenthetical citation embeds a DOI, a URL ends before a period, or a model drops a marker.
Writing a citation-safe editing pipeline looks simple until you diff real manuscripts. Under Purdue OWL's author citation rules , two-author parentheticals take & ( (Wegener & Petty, 1994) ), narrative signal phrases spell out and ( Wegener and Petty (1994) ), and three or more authors take et al. with a period only after al. ( (Kernis et al., 1993) ). Crossref's display guidelines add full https://doi.org/10.xxxx/xxxxx links without doi: prefixes or dx. subdomains. Language models routinely swap & for and , turn et al.…