Get email address from mailbox string

前端 未结 5 1730
梦如初夏
梦如初夏 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:49

    If you know that the string is surrounded by < and > you can simply split out according to that.

    This assumes that you will always have only one pair of < and > surrounding the string, and it will not ensure that the result is an email pattern.

    Otherwise you can always read up on email regex patterns.

提交回复
热议问题