title: php, get src from iframe preg_replace
body: <p>I have a string that contains iframe</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;iframe width="560" height="315" src="https://www.test.com/" title="test" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen&gt;&lt;/iframe&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>how do i use preg_replace to extract the link that contains it; I have to extract the following link
  'https://www.test.com/'</p>
  <p>obvious by clearing the string from the iframe tag</p>
  <p>// I HAVE SOLVED THIS</p>
  <pre><code> $stringaiframe = 'test inserisco ifram tag &lt;iframe width=&quot;560&quot; height=&quot;315&quot; src=&quot;https://www.test.com/&quot; title=&quot;test&quot; frameborder=&quot;0&quot; allow=&quot;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture&quot; allowfullscreen&gt;&lt;/iframe&gt;';
  $stringaiframe = preg_replace('/&lt;iframe\s+.*?\s+src=(&quot;[^&quot;]+&quot;).*?&lt;\/iframe&gt;/', '&quot;&quot;&quot;&quot;&quot;&quot;$1&quot;&quot;&quot;&quot;&quot;&quot;', $stringaiframe);
  </code></pre>