I have this file/string:
----- Transcript of session follows -----
... while talking to mta6.am0.yahoodns.net.:
>>> DATA
<<< 554 delivery error: dd Sorry your message to foo@yahoo.com cannot be delivered. This account has been disabled or discontinued [#102]. - mta1070.mail.ac4.yahoo.com
554 5.0.0 Service unavailable
--p94IAEl4012027.1317751814/foo.com
----- Transcript of session follows -----
... while talking to mail.messaging.microsoft.com.:
>>> DATA
<<< 550 5.7.1 Service unavailable; Client host [foo] blocked using Blocklist 2, mail from IP banned; To request removal from this list please forward this message to foo@foo.com.
550 5.1.1 <foo@foo.com>... User unknown
<<< 503 5.5.2 Need rcpt command
--p94I91SC011973.1317751741/foo.com
Content-Type: message/delivery-status
And I need to get the part after “transcript of session follows—“, up to the blank new line (or double new_line I think).
I tried something like this
<?php preg_match("/----- Transcript of session follows -----\n(.*)\n\n/",$email, $transcript_matches);?>
but is incorrect, instead of .* I probably need any char OR new line but NOT two new lines. And right after it two new lines. How can I write that?
Thank you.
Two things:
//smodifier to specify that.can match newlines. See http://php.net/manual/en/reference.pcre.pattern.modifiers.php for details on regex modifiers in php..*?to specify a non-greedy match (it will match the shortest string it finds).Putting it together:
Also note: If you are trying to get “–p94IAEl4012027.1317751814/foo.com” as part of your results, then notice that it is three newlines lines you are looking for, not two. In other words: two blank lines == three newline characters.