# Replace module not replacing all matched words in a file

**URL:** <https://forum.ansible.com/t/replace-module-not-replacing-all-matched-words-in-a-file/26587>\
**Category:** Ansible Project\
**Created:** [January 29, 2018, 3:26pm UTC](https://forum.ansible.com/t/replace-module-not-replacing-all-matched-words-in-a-file/26587 "2018-01-29T15:26:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dave](https://avatars.discourse-cdn.com/v4/letter/d/ee7513/32.png) [@Dave](https://forum.ansible.com/u/Dave)\
**Post date:** [January 29, 2018, 3:26pm UTC](https://forum.ansible.com/t/replace-module-not-replacing-all-matched-words-in-a-file/26587/1 "2018-01-29T15:26:18Z")

</div>

I’m running into an issue with the replace module that I’m not sure how to resolve. When I run the below Ansible code, it generates a config file, but misses the first regexp in my first blockinfile call. All the other lines after the first regexp match work perfectly fine. I tried specifying a carot at the beginning of the ‘\b24x7’ regex pattern to search from the beginning of the file, but that didn’t work. Could someone let me know if I’m missing something?

`
