【发布时间】:2015-07-14 07:24:46
【问题描述】:
我正在尝试从电子邮件正文中提取 From:address。这是我目前所拥有的:
$string = "From: user1@somewhere.com This is just a test.. the original message was sent From: user2@abc.com";
$regExp = "/(From:)(.*)/";
$outputArray = array();
if ( preg_match($regExp, $string, $outputArray) ) {
print "$outputArray[2]";
}
我想得到From: ..第一次出现的电子邮件地址有什么建议吗?
【问题讨论】:
标签: php regex preg-match