doucuo9126 2014-11-27 20:04
浏览 107
已采纳

如何从html中以邮件[@] domain.com格式提取电子邮件地址?

I want to extract email address from html source.

i was using below to code to extract the email address in the format mail@domain.com

function extract_email_address ($string) {
    foreach(preg_split('/\s/', $string) as $token) {
        $email = filter_var(filter_var($token, FILTER_SANITIZE_EMAIL), FILTER_VALIDATE_EMAIL);
        if ($email !== false) {
            $emails[] = $email;
        }
    }
    return $emails;
}

Now, it looks like the email is protected with [] symbol, the email address looks like

mail[@]domain.com, (Notice the @ symbol withing []). So, the above code did not help.

anybody knows answer for this question?

  • 写回答

1条回答 默认 最新

  • droc60607 2016-04-01 18:32
    关注

    You could just replace [@] with @ - [ Answered by Brad].

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 mmseqs内存报错
  • ¥15 vika文档如何与obsidian同步
  • ¥15 华为手机相册里面的照片能够替换成自己想要的照片吗?
  • ¥15 陆空双模式无人机飞控设置
  • ¥15 sentaurus lithography
  • ¥100 求抖音ck号 或者提ck教程
  • ¥15 关于#linux#的问题:子进程1等待子进程A、B退出后退出(语言-c语言)
  • ¥20 web页面如何打开Outlook 365的全球离线通讯簿功能
  • ¥15 io.jsonwebtoken.security.Keys
  • ¥15 急,ubuntu安装后no caching mode page found等