# regex\_replace in Ansible 2.8.0

**URL:** <https://forum.ansible.com/t/regex-replace-in-ansible-2-8-0/30794>\
**Category:** Ansible Project\
**Created:** [July 16, 2019, 6:25pm UTC](https://forum.ansible.com/t/regex-replace-in-ansible-2-8-0/30794 "2019-07-16T18:25:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam5](https://avatars.discourse-cdn.com/v4/letter/s/9dc877/32.png) [@Sam5](https://forum.ansible.com/u/Sam5)\
**Post date:** [July 16, 2019, 6:25pm UTC](https://forum.ansible.com/t/regex-replace-in-ansible-2-8-0/30794/1 "2019-07-16T18:25:01Z")

</div>

Using Ansible 2.8.0 on Centos 7 with Python 2.7.5

This regex\_replace hangs when there is no match. Any idea why this would hang?

tasks:

- set\_fact:  
departStatusDownloadPattern: "  
(?sm)._?\<TD._?Depart Status._?\<\/TD\>\s\s_  
\<TD._?TD\>\s\s_  
\<TD._?DocumentType=AUTH;GAUTH._?Organization=._?\<\/TD\>\s\s_  
\<TD._?TD\>\s\s_  
\<TD._?{{ lookup(‘pipe’, ‘date +"%-b %-d, %Y"’) }}._?\<\/TD\>\s\s\*  
\<TD._?TD\>\s\s_  
\<TD._?TD\>\s\s_  
\<TD._?TD\>\s\s_  
\<TD._?Completed on {{ lookup(‘pipe’, ‘date +"%-b %-d, %Y"’) }}._?\<\/TD\>\s\s\*  
\<TD._?TD\>\s\s_  
\<TD._?javascript:setSelected\('(._?)'\).\*"
- debug:  
msg: “{{ lookup(‘file’, ‘work/reportsPage.html’) | regex\_replace(departStatusDownloadPattern,‘\1’) }}”
