Use “\A...\z”, not “^...$” with Python regular expressions
Summary
The article explains how the traditional ^...$ end-of-line anchor can unintentionally match trailing newlines in Python, and advocates for using end-of-string anchors like \A and \z. It notes that Python 3.14 adds \z support, bringing Python closer to other engines, with cross-implementation caveats and historical context from OpenSSF research.