Home >Backend Development >PHP Tutorial >标签-php正则表达式问题????
标签stringphp正则表达式
<code> <?php $pattern = "/<p.*p>|<div>]+>/"; $str = "<div style='\"width:100px\"'>无语<p>hi</p> </div>"; preg_match_all($pattern,$str,$matches); var_dump($matches);?><p>请问为什么结果是:</p> <pre class="brush:php;toolbar:false"><code> array (size=1) 0 => array (size=2) 0 => string '<div style="width:100px">' (length=25) 1 => string '<p>hi</p>' (length=13)<p>应该先匹配出p标签吗?</p> </div></code>