
以下是一个使用PHP正则表达式来提取HTML列表(li标签)中内容的实例。我们将使用`preg_match_all`函数来查找所有匹配的列表项。
```php
$htmlContent = <<
- 苹果
- 香蕉
- 橘子
- 葡萄
HTML;
// 正则表达式匹配所有的li标签
$pattern = '/
// 使用preg_match_all来查找所有匹配的列表项
preg_match_all($pattern, $htmlContent, $matches);
// 打印所有匹配的列表项
echo "

以下是一个使用PHP正则表达式来提取HTML列表(li标签)中内容的实例。我们将使用`preg_match_all`函数来查找所有匹配的列表项。
```php
$htmlContent = <<
HTML;
// 正则表达式匹配所有的li标签
$pattern = '/
// 使用preg_match_all来查找所有匹配的列表项
preg_match_all($pattern, $htmlContent, $matches);
// 打印所有匹配的列表项
echo "