This related topic provided the answer: multiline automatically escapes \
so this change works:
wai2: >-
{{ 'ansible' | regex_replace('^a.*i(.*)$', 'a\1') }}
This related topic provided the answer: multiline automatically escapes \
so this change works:
wai2: >-
{{ 'ansible' | regex_replace('^a.*i(.*)$', 'a\1') }}