Hi,
I need to replace a dot in a string with a "\!". I am using "regex_replace" 
but am unable to get the regex to print a single backslash.

I have tried escaping it using double-backslash but that gives me 2 
backslashes in the output. Interestingly escaping using 4 backslashes also 
gives 2 backslashes in the output - so could this be a bug?

Ansible version is 2.2.1.0


---
- name: install MQ 8
  hosts: 192.168.90.84
  vars:
    qmgr: PAAA.QMGR
  tasks:
    - debug:
        msg: "{{ ini }}"
      vars:
        ini: "{{ qmgr | regex_replace('[.]','\\!') }}"



Here is the output:

TASK [debug] 
*******************************************************************
ok: [192.168.90.84] => {
    "msg": "PAAA\\!QMGR"
}


Thanks

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6308c90f-8ac5-42d0-9ba6-ed8ba4841eda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to