Matthew Barnett added the comment: The pattern '\</?root\>', which is the same as '</?root>', matches the string '<root>', and that is replaced with ''. ---------- _______________________________________ Python tracker <report at bugs.python.org> <http://bugs.python.org/issue26354> _______________________________________