Reputation: 13
I have this string in php i want to skip the ppattern
------------------------------------------
FROM:Andy;
SENT:Mon, Jun 18 2012 1:52pm
TO:Ali;
------------------------------------------
FROM:Ali;
SENT:Mon, Jun 18 2012 12:26pm
TO:Andy;
Some message text here
I want to use regular expression to skip first two patterns and return only "Some message text..." there can be more of above two pattern. In PHP
Upvotes: 1
Views: 59
Reputation: 14099
.*TO:.*;\s*(.*)
Be sure to set dot matches newline
In php (preg) this becomes
if (preg_match('/.*TO:.*;\s*(.*)/s', $subject, $regs)) {
$result = $regs[1];
} else {
$result = "";
}
Upvotes: 0