regex_replace filter is not working

Hi all.
I am trying to use regex_replace to capture the host name in a url. This is the code : {{ openerp_url | regex_replace(‘^(?:h.//)?(.)(?:(?::|/).*)$’, ‘\1’) }}. But, when the playbook is run, it is only giving \1 as the output. Checked with the latest ansible dev version as well. No luck. Even, the example given in the documentation {{ ‘ansible’ | regex_replace(‘^a.i(.)$’, ‘a\1’) }} gives a\1 as output.

Thanks,

I'm using 2.1.2 and can't confirm this behavior.

The playbook i tested

Found the issue. I was using blockinfile module. The regex_replace usage in question is sent to the ‘block’ parameter. It was using a multi line string using |. That was automatically escaping the second argument.