title: Ansible extract substring from multiline string containing url
body: <p>I'm trying to extract a substring from a multine string with Ansible regex without success.</p>
  
  <p>I have this ouput from an excuted command (<code>teleport users add</code>):</p>
  
  <blockquote>
    <p>"stdout": "Signup token has been created and is valid for 3600 seconds. Share this URL with the user:\nhttps://main-proxy:3080/web/newuser/d32ed2bc0ebb0084a381123e3eff0bfa\n\nNOTE: make sure 'main-proxy' is accessible!"</p>
  </blockquote>
  
  <p>I would like to extract juste the token. Here: <code>d32ed2bc0ebb0084a381123e3eff0bfa</code>.</p>
  
  <p>I registered the output in a result variable, and I'm trying to extract the token without success:</p>
  
  <pre><code>- set_fact:
      signup_token: '{{ result.stdout | regex_replace("^(?s)^https:\/\/.*\/(.+).*?$", "\\1") }}'
  - debug: msg={{ signup_token }}
  </code></pre>
  
  <p>What's the right regex and syntax?</p>