This is a result of some normalization code in jinja2 that attempts to unescape strings:
https://github.com/pallets/jinja/blob/d594969d722ceb4e8f3da8861befc9c0ac87ae1b/src/jinja2/lexer.py#L647-L653 That code results in those becoming '^p(\\d+).*$' and '\\1'. Those 2 when statements, when processed by pyyaml become: ["( item | regex_replace('^p(\\d+).*$', '\\\\1') ) in s", "( item | regex_replace('^p(\\\\d+).*$', '\\\\1') ) in s"] Then if we apply the .encode/.decode: >>> "( item | regex_replace('^p(\\d+).*$', '\\\\1') ) in s".encode("ascii", "backslashreplace").decode("unicode-escape") "( item | regex_replace('^p(\\d+).*$', '\\1') ) in s" >>> "( item | regex_replace('^p(\\\\d+).*$', '\\\\1') ) in s".encode("ascii", "backslashreplace").decode("unicode-escape") "( item | regex_replace('^p(\\d+).*$', '\\1') ) in s" -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v-Sf3AmrkEnFZZtxAbJHTUv%3D6gNezDkESTxoatHq-86YA%40mail.gmail.com.
