再正则

WBOY
WBOYOriginal
2016-06-13 13:49:17853browse

再求一个正则
比如我有

......(略)
...(略)
....(略)

......(略)
‎(105)





我只要其中 class=cnt 的span,并且只要105这个数字;请问该如何写?

------解决方案--------------------
得到 数组 foo 之后做个判断,万一没有匹配内容的话直接输出会有出错提示.
PHP code

$str = '<span class="cnt">‎(105)</span>';
preg_match ( '/<span class="cnt">.*\(([\d]+)\)/', $str, $foo );
$bar=isset ($foo[1])? $foo[1]:'';
echo $bar; <div class="clear">
                 
              
              
        
            </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