Is it possible that "Sent to" can be optional?
You have been really helpful. I appreciate it.
On 23/02/15 01:18, Jigar Dhulla wrote:
Hi,
(.*?) - Any character
(\s*?) - Multiline spaces and tabs
On Mon, Feb 23, 2015 at 11:47 AM, Ron Piggott
<ron.piggott@xxxxxxxxxxxxxxxxxx
<mailto:ron.piggott@xxxxxxxxxxxxxxxxxx>> wrote:
Thank you.
Can you explain what
(.*?)(\s*?)
do?
Ron
On 23/02/15 00:36, Jigar Dhulla wrote:
http://refiddle.com/24zw
<?php
preg_match('/Sent
to(.*?)(\s*?)On(\s)(\d){2}-(\d){2}-(\d){2}(\s)(\d){2}\:(\d){2}(\s)(AM|PM),(.*?)(wrote:)/ig',
$correspondence, $matches);
var_dump($matches);
?>
On Mon, Feb 23, 2015 at 10:03 AM, Ron Piggott
<ron.piggott@xxxxxxxxxxxxxxxxxx
<mailto:ron.piggott@xxxxxxxxxxxxxxxxxx>> wrote:
I am wondering if someone could help me parse the text that
appears above
"On 15-02-19 02:31 PM, The Verse of the Day Inquiries wrote:"
from the variable" $correspondence "
$correspondence = <<<EOF
Looking to see if this message is appended to the original
ticket #
3784.
Sent to inquiries@xxxxxxxxxxxxxxxxxxxxx
<mailto:inquiries@xxxxxxxxxxxxxxxxxxxxx>
On 15-02-19 02:31 PM, The Verse of the Day Inquiries wrote:
>
> *=== To reply please type your response ABOVE THIS LINE
===*
EOF;
What I have worked out so far is:
if ( strpos( $correspondence , '=== To reply please type your
response ABOVE THIS LINE ===' ) ) {
$correspondence = substr(
$correspondence,
0,
strpos(
$correspondence,
'=== To reply please type your response ABOVE
THIS LINE
==='
)
);
}
The date time and business e-mail account name will be
dynamic. The type of pattern to match would be
- starting with "On"
- ending with "wrote:"
Thank you for any help / guidance.
--
Regards,
Jigar Dhulla
--
Regards,
Jigar Dhulla