正規表現を含む php コードがあり、li タグ内の p タグの新しい行で失敗します。このコードを実行すると、コードが削除</ul></li>
されます。
<?php
$data = "<h1>test</h1>
<h2>test</h2>
<p>This is not real text but just a test, This is not real text but just a test, This is not real text but just a test, This is not real text but just a test, This is not real text but just a test</p>
<ul><li><p>This is not real text but just a test, This is not real text but just a test, This is not real text but just a test, This is not real text but just a test</p>
</li></ul>
<ul><li><p>This is not real text but just a test, This is not real text but just a test, This is not real text but just a test, This is not real text but just a test</p>
</li></ul>";
$pattern = "#[\<ul\>\<li\>]*\<[p]*[h1]*[h2]*[h3]*\>(.+?)\</[p]*[h1]*[h2]*[h3]*\>[\</li\>\</ul\>]*#is";
preg_match_all($pattern, $data, $output);
var_dump($output);
?>
誰でもこれで私を助けることができますか?