# replace module.  Please explain \\1 \\2

**URL:** <https://forum.ansible.com/t/replace-module-please-explain-1-2/25537>\
**Category:** Ansible Project\
**Created:** [September 19, 2017, 9:19pm UTC](https://forum.ansible.com/t/replace-module-please-explain-1-2/25537 "2017-09-19T21:19:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Harmon](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Harmon](https://forum.ansible.com/u/John_Harmon)\
**Post date:** [September 19, 2017, 9:19pm UTC](https://forum.ansible.com/t/replace-module-please-explain-1-2/25537/1 "2017-09-19T21:19:36Z")

</div>

I am trying to use the replace module, and I see all of these examples with \1 and \2 in them. I assume these are for backrefs or soemthing? Can someone explain it to me? I am trying to append “sss” to my passwd and group lines in my nsswitch file. I haven’t tested my code yet, but I would still like to know what \1 \2 mean. Maybe someone can point me to some documentation as I can’t seem to find anything on it myself.

`

- name: Update nsswitch.conf  
replace:  
path: /etc/nsswitch.conf  
regexp: {{item.regexp}}  
replace: {{item.replace}}  
with\_items:
- {regexp: ‘^passwd.\*’  
replace: “\1 sss” },
- {regexp: ‘^group.\*’  
replace: “\1 sss” }

`

---

<div class="post-metadata">

**Author:** ![gordonmessmer](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/gordonmessmer/32/1925_2.png) [@gordonmessmer](https://forum.ansible.com/u/gordonmessmer)\
**Post date:** [September 19, 2017, 9:24pm UTC](https://forum.ansible.com/t/replace-module-please-explain-1-2/25537/2 "2017-09-19T21:24:12Z")

</div>

Yes, those appear to be regex back-references. The documentation is here:

[http://docs.ansible.com/ansible/latest/replace\_module.html](http://docs.ansible.com/ansible/latest/replace_module.html)
