【发布时间】:2017-08-07 07:22:21
【问题描述】:
我想知道如何匹配某些电子邮件(带有所需的域名)一个例子;
我想提取所有以“.es”或“.pt”、“.com.mx”等结尾的电子邮件...我编写了一个小脚本来过滤一些电子邮件; “hotmail.com”、“aol.com”、“gmail.com”...
<?php
$emails = $_POST['emails'];
$ex = explode("\n", $emails);
$count = count($ex);
if (isset($emails) && $count >= 1) {
echo "<center><font color = 'red'><b>$count </font>Number of emails </b></center><br />";
} else {
echo "<center>
No email </center>";
exit;
}
if (isset($emails)) {
for ($i = 0; $i <= $count; $i++) {
$d = strtolower($ex[$i]);
if (strstr($d, "@hotmail") || strstr($d, "@live") || strstr($d, "@msn") || strstr($d, "@outlook")) {
$hotmail .= $d;
$nh = $nh + 1;
} else {
if (strstr($d, "@yahoo") || strstr($d, "@ymail")) {
$yahoo .= $d;
$ny = $ny + 1;
}
}
?>
【问题讨论】:
-
.*@.*?\.(es|pt|pt|com.mx)类似的东西