title: Unable to print lines matching string using Ansible regex
body: <p>I wish to search for all entries of string starting with "SSLFile" or starting with "SSLFile" in a file(httpd.conf) on remote host; register it to a variable and print all the matches found using ansible regex.</p>
  
  <p>Using slurp and shell module i was able to read the remote file contents.</p>
  
  <pre><code> - name: Slurp certificate entries
    slurp:
      src: "{{ httpd_home }}/conf/httpd.conf"
  #    shell: "cat {{ httpd_home }}/conf/httpd.conf"
    register: filecontent
  
  - name: Find certificate entries
    set_fact:
      input: "{{ filecontent['content'] | b64decode }}"
  
  - name: Regex String
    set_fact:
      target: "{{ input | regex_replace('\\sSSLFile.*, '\\1') }}"
  </code></pre>
  
  <p>All good except the last regex task where I try to search for regex pattern and assign it to variable called "target". It fails right there and gives the below debug -vvvv error message:</p>
  
  <pre><code>TASK [Regex String] ***************************************
  task path: /app/test.yml:908
  The full traceback is:
  Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 144, in run
  res = self._execute()
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 576, in _execute
  self._task.post_validate(templar=templar)
  File "/usr/lib/python2.7/site-packages/ansible/playbook/task.py", line 268, in post_validate
  super(Task, self).post_validate(templar)
  File "/usr/lib/python2.7/site-packages/ansible/playbook/base.py", line 384, in post_validate
  value = templar.template(getattr(self, name))
  File "/usr/lib/python2.7/site-packages/ansible/template/__init__.py", line 584, in template
  disable_lookups=disable_lookups,
  File "/usr/lib/python2.7/site-packages/ansible/template/__init__.py", line 539, in template
  disable_lookups=disable_lookups,
  File "/usr/lib/python2.7/site-packages/ansible/template/__init__.py", line 773, in do_template
  data = _escape_backslashes(data, myenv)
  File "/usr/lib/python2.7/site-packages/ansible/template/__init__.py", line 145, in _escape_backslashes
  for token in jinja_env.lex(d2):
  File "/usr/lib/python2.7/site-packages/jinja2/lexer.py", line 733, in tokeniter
  name, filename)
  TemplateSyntaxError: unexpected char u'\\' at 51
  line 1 fatal: [10.9.9.11]: FAILED! =&gt; {
  "msg": "Unexpected failure during module execution.",
  "stdout": ""
  }
  </code></pre>
  
  <p>Can you please suggest how can I grab all the lines matching the pattern ?</p>