내용에 src, href 주소 추출 정규식 > PHP

STUDY ROOM

PHP

내용에 src, href 주소 추출 정규식

페이지 정보

작성자 JMStudy 작성일17-05-23 18:43 조회13,654회 댓글0건

본문

 

 

<?

$subject = '<iframe width="640" height="360" src="https://www.youtube.com/embed/_3tpMK5-CZk" frameborder="0" allowfullscreen></iframe>';

$pattern ='/(src=|href=)(\'|\")?([^<>\s\'\"]*)(\'|\"|\s|)/i';

 

preg_match_all( $pattern, $subject, $matches );

 

echo $matches[3][0];

?>​ 

댓글목록

등록된 댓글이 없습니다.