Home >Backend Development >PHP Tutorial >标签-php正则表达式问题????

标签-php正则表达式问题????

WBOY
WBOYOriginal
2016-06-02 11:28:02964browse

标签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>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:设计-网站框架整合问题,请各位大牛指点!Next article:思路-php怎么查询当前是校历的第几周

Related articles

See more