如何在php中使用正则表达式过滤html邮件作为回复
我收到这样的html邮件如何在php中使用正则表达式过滤html邮件作为回复,php,regex,filter,Php,Regex,Filter,我收到这样的html邮件 <div dir="ltr">last message</div> <div class="gmail_extra"> <br> <div class="gmail_quote"> 2016-04-09 16:30 GMT+04:00 <span dir="ltr"><<a href="mailto:mymail@example.c
<div dir="ltr">last message</div>
<div class="gmail_extra">
<br>
<div class="gmail_quote">
2016-04-09 16:30 GMT+04:00
<span dir="ltr"><<a href="mailto:mymail@example.com" target="_blank">mymail@example.com</a>></span>:
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb">
<div class="h5">
On 2016-04-09 13:05, repliername repliersurname wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
the third reply message text<br>
On Fri, Apr 8, 2016 at 10:47 PM, <<a href="mailto:mymail@example.com" target="_blank">mymail@example.com</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 2016-04-08 21:14, repliername repliersurname wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
the first reply message text<br>
</blockquote>
<br>
the second reply message text<br>
</blockquote>
</blockquote>
<br>
</div>
</div>
the fourth reply message text<br>
</blockquote>
</div>
<br>
</div>
$mail = [
"content" => "last message",
"replies" => [
"date" => "2016-04-09 16:30",
"from" => "mymail@example.com",
"content" => "the fourth reply message text",
"reply" => [
"date" => "016-04-09 13:05",
"from" => "repliername repliersurname",
"content" => " the third reply message text",
"reply" => [
"date" => "2016-04-08 22:47",
"from" => "mymail@example.com",
"content" => "the second reply message text",
"reply" => [
"date" => "2016-04-08 21:14",
"from" => "repliername repliersurname",
"content" => "the first reply message text"
]
]
]
]
];
它必须用正则表达式进行过滤。。。
请帮帮我。。。
我不知道该怎么做…我解决了正则表达式的问题
preg_match('#<blockquote[^>]+>(.+?)</blockquote>#ims', $text, $matches);
echo "<pre>";
print_r($matches);