title: Find iFrame in HTML and check its SRC
body: <p>I have a website where a user can <strong>among other objects like text and images</strong> also insert a YouTube video into CKEditor type textarea form. </p>
  
  <p>YouTube video is embedded by iFrame objects.  But I don't want users to be able to insert any other iFrame except for YouTube (I am sure you can guess why)</p>
  
  <p>So when the form is submitted I want to scan the <strong>$text</strong> variable for all iFrames and if they do not point to <strong>youtube.com</strong> or <strong>youtube-nocookie.com</strong>, remove those iFrame tags.</p>
  
  <p>These are iFrames with allowed sources:</p>
  
  <pre><code>&lt;iframe allowfullscreen="" frameborder="0" height="360" src="//www.youtube.com/embed/6dk-5HN4fvg" width="640"&gt;&lt;/iframe&gt;
  
  &lt;iframe allowfullscreen="" frameborder="0" height="360" src="//www.youtube-nocookie.com/embed/IY37l4PDsao" width="640"&gt;&lt;/iframe&gt;
  </code></pre>
  
  <p>The task:</p>
  
  <ol>
  <li>find the iFrame</li>
  <li>find the value of its SRC</li>
  <li>check if it is an allowed domain</li>
  <li>if not delete it, or disable it, but preserve the rest of the surrounding HTML</li>
  <li>check if there is another</li>
  </ol>