我需要刪除這些HTML塊之間的內容:PHP的preg_replace HTML內容
$var1 ="
<html><head>
<meta http-equiv='content-type' content='text/html; charset=ISO-8859-1'></head><body>
<img alt='shopozilla' src='http://www.ssopte.com/images/2010/usdos-logo-seal.png' >
<span style='font-family: Arial,Helvetica,sans-serif; color: rgb(93, 93, 93);
font-size: 17px; font-weight: bold;'>shopozilla sent this message to
";
$var2 = "
Section 222 of the sand sAct. Section 222(f) provides that the records of the separtment of State and of diplomatic and consular </font><br>
</td></tr></tbody></table></td></tr></tbody></table></body></html>
";
到目前爲止,我試過
<pre>
$content = preg_replace("/$var1(.*)$var2/m", "", $htmlContent);
</pre>
但不工作,所以我需要一個模式/正則表達式應該工作。
請參閱:http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags – 2011-02-25 19:44:26