求一个匹配html格式的正则!!
<br /> <ul id="ul1"><br /> <li>1</li><br /> <li>2</li><br /> </ul><br />
<?php<br /> <br /> $str = 'afdasdfdsa<ul id="ul1"><br /> <li>1</li><br /> <li>2</li><br /> </ul>asdfasdfasd<ul id="ul2"><br /> <li>3</li><br /> <li>4</li><br /> </ul>fdsgsdfg';<br /> <br /> preg_match_all('/<ul[^>]*>.*<\/ul>/isU', $str, $matches);<br /> print_r($matches[0]);<br /> <br /> ?>
<?php <br /> $str = '<ul id="ul1"><br /> <li>1</li><br /> <li>2</li><br /> </ul><br /> <ul id="ul1"><br /> <li>3</li><br /> </ul><br /> <ul id="ul1"><br /> <li>4</li><br /> <li>5</li><br /> <li>6</li><br /> </ul>';<br /> preg_match_all('/<ul.*?>.*?<\/ul>/s', $str, $matches);<br /> var_dump($matches);