php

php 정규식 사용해서 이메일주소 추출

xemaker 2017. 10. 13. 17:41

<?

$content="1. xss@hanmail.net dd 2. ddd@naver.com ff 3. ddd@yahoo.co.kr dfsd";


preg_match_all( "/[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/i", $content, $matches );


print_r($matches);

print_r($matches[0]);


?>