title: How to escape 1 or more whitespaces in a regex in the lineinfile module of Ansible?
body: <p>I am using Ansible to set some variables on a file using the <code>lineinfile</code> module.
  The problem I'm bumping into is how to have a regular expression that is flexible enough to have some spaces in the middle of the string. Please see below:</p>
  
  <pre><code>- name: Set DB IP in db conn file
    lineinfile: 
      dest=/path/to/db_conn
      regexp="{{ item.regexp }}"
      line="{{ item.line }}"
    with_items:
      - { regexp: "^.?dbschema_audit=",
          line: "$dbschema_audit=\'{{ db_schema_audit }}\';" }
      - { regexp: "^.?dbschema_audit_trail\s\*=",
          line: "$dbschema_audit_trail=\'{{ db_schema_audit_trail }}\';" }
  </code></pre>
  
  <p>The file I'm trying to change has lines like these:</p>
  
  <pre><code>$dbschema_audit='a';
  $dbschema_audit_trail ='a';
  </code></pre>
  
  <p>I have tried different variations of <code>\s*</code> with <code>{</code>, <code>'</code> and <code>\</code> and nothing seems to work. Can I have some wisdom from out there?</p>