Get email address from mailbox string

前端 未结 5 1780
梦如初夏
梦如初夏 2021-01-12 10:53

I need to extract the email address out of this mailbox string. I thought of str_replace but the display name and the email address is not static so I don’t kno

5条回答
  •  一个人的身影
    2021-01-12 11:31

    at face value, the following will work:

    preg_match('~<([^>]+)>~',$string,$match);
    

    but i have a sneaking suspicion you need something better than that. There are a ton of "official" email regex patterns out there, and you should be a bit more specific about the context and rules of the match.

提交回复
热议问题