# Replace command not picking up on my regex

**URL:** <https://forum.ansible.com/t/replace-command-not-picking-up-on-my-regex/28981>\
**Category:** Ansible Project\
**Created:** [November 8, 2018, 5:32pm UTC](https://forum.ansible.com/t/replace-command-not-picking-up-on-my-regex/28981 "2018-11-08T17:32:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![EspressoBeanies](https://avatars.discourse-cdn.com/v4/letter/e/ea666f/32.png) [@EspressoBeanies](https://forum.ansible.com/u/EspressoBeanies)\
**Post date:** [November 8, 2018, 5:32pm UTC](https://forum.ansible.com/t/replace-command-not-picking-up-on-my-regex/28981/1 "2018-11-08T17:32:52Z")

</div>

I’m trying to use Ansible to add several lines of text after a specific line in a config file using the replace module and for whatever reason when I run the playbook, I get back OK responses instead of CHANGED. Below is the following line in the config file:

`check_interval 24x7`

Replace code in Ansible playbook:

`replace: path: "{{ nameof }}.cfg" regexp: '\b24x7' replace: '24x7\n\t.....' after: '\b24x7'`

Verbose response:

`TASK [Add alerting procedures] ********************************************************************************************************************************************************************************************* task path: /opt/ansible/ansible-to-nagios.yml:81 ok: [127.0.0.1] => { "changed": false, "invocation": { "module_args": { "after": "\\b24x7", "attributes": null, "backup": false, "before": null, "content": null, "delimiter": null, "directory_mode": null, "encoding": "utf-8", "follow": false, "force": null, "group": null, "mode": null, "owner": null, "path": "test.cfg", "regexp": "\\b24x7", "remote_src": null, "replace": "24x7\\n\\t.....", "selevel": null, "serole": null, "setype": null, "seuser": null, "src": null, "unsafe_writes": null, "validate": null } }, "msg": "" }`
