Home  >  Article  >  Backend Development  >  PHP怎么用正则表达式匹配圆括号

PHP怎么用正则表达式匹配圆括号

WBOY
WBOYOriginal
2016-06-13 13:47:041224browse

PHP如何用正则表达式匹配圆括号
我在做CURL数据采集,要获取

............

之间的内容,

我使用正则表达式来获取。

正则表达式我写成

(.*)



(.*)



都不行。应该如何写呢?

------解决方案--------------------
试试,没有问题

如果匹配多行,正则/……/s s来修饰
PHP code

$html    =<p class="jianju">............</p><div></div>之间的内容,
DOC;

preg_match('/<span><p>(.*)</p>
<div>/', $html, $m);
print_r($m[1]); <div class="clear">
                 
              
              
        
            </div>
</div></span>

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