In PHP, how do I extract multiple e-mail addresses from a block of text and put them into an array?

前端 未结 7 2179
时光说笑
时光说笑 2020-11-30 03:19

I have a block of text from which I want to extract the valid e-mail addresses and put them into an array. So far I have...

   $string = file_get_contents(\         


        
7条回答
  •  南笙
    南笙 (楼主)
    2020-11-30 03:47

    This regex will extract all unique email address from a url or file and output each in new line. It will consider all subdomains and prefix suffix issues. Find comfortable to use it.

    ";
    }
    }
    else {
    echo "No emails found.";
    }
    ?>
    

    check here for more reference : http://www.php.net/manual/en/function.preg-match-all.php

提交回复
热议问题