How to get email address from a long string

前端 未结 13 1973
情书的邮戳
情书的邮戳 2020-11-27 04:29

In PHP, I have a string like this:

$string = \"user@domain.com MIME-Version: bla bla bla\";

How do i get the email address only? Is there a

13条回答
  •  南方客
    南方客 (楼主)
    2020-11-27 04:34

    Have a look at Regular expressions in PHP.

    With regular expressions you can identify any text pattern in a given string. They are incredibly useful. So even though you can stick with copy-pasting a code snippet from another answer for now, you should consider digging a little more into it.

    It can be a bit complex at first but it's definitely worth the effort.

提交回复
热议问题