regex_replace in Ansible 2.8.0

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’) }}”