Home > Backend Development > PHP Tutorial > 求解一个php正则表达式的组合,该如何解决

求解一个php正则表达式的组合,该如何解决

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:18:37
Original
761 people have browsed it

求解一个php正则表达式的组合
(.*?) 这个匹配是是任意多个字符 为什么不直接(*?)

------解决方案--------------------
你是想说为什么不用“.*”吧?
看下面例子:

PHP code
$str = 'aabab';$pattern1 = '/a.*b/';    //匹配出aabab$pattern2 = '/a.*?b/';   //匹配出aab<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