$p = "/<ul><li>(.*?)<\/li>\s*<li>(.*?)<\/li>\s*<\/ul>/i";
<?php
$p = "/<ul><li>(.*?)<\/li>\s*<li>(.*?)<\/li>\s*<\/ul>/i";
$str = "<ul>
<li>item 1</li>
<li>item 2</li>
</ul>";
//在这里补充代码,实现正则匹配所有li中的数据
preg_match_all($p, $str, $matches);
print_r($matches[0]);