Home > Backend Development > PHP Tutorial > PHP关于正则表达式的有关问题

PHP关于正则表达式的有关问题

WBOY
Release: 2016-06-13 13:47:58
Original
965 people have browsed it

PHP关于正则表达式的问题

asdasd

zxczxc


我是用正则表达式
([\s\S]*)


匹配出来的结果是:asdasd
zxczxc

但是我需要的结果是:asdasd

请问各位大大如何解决,这个正则表达式怎么写才能让他匹配与其相对应的


------解决方案--------------------
PHP code
$str=asdasd
<div>zxczxc</div>
html;
preg_match_all('#<div>(.*)</div>#isU',$str,$arr);
print_r($arr[1]); <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template