fork download
  1. <?php
  2.  
  3. $conteudonoticia = '[caption id="attachment_42478" align="alignleft" width="640"] <img class="wp-image-42478 size-full" src="http://paginalocal/wp-content/uploads/2016/12/20140815_174009.jpg" alt="20140815_174009" width="640" height="480" />Objetivo com a antecipação é garantir comodidade e tranquilidade aos servidores para as festas de final de ano[/caption]';
  4.  
  5. preg_match_all('#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $conteudonoticia, $match);
  6.  
  7.  
  8.  
  9. $url = (implode(':', $match[0]));
  10.  
  11. echo $url;
Success #stdin #stdout 0.01s 82944KB
stdin
Standard input is empty
stdout
http://paginalocal/wp-content/uploads/2016/12/20140815_174009.jpg