Home > Backend Development > PHP Tutorial > 谁能给我解释下这个正则呢 '/[qlist:(.*?)]/'

谁能给我解释下这个正则呢 '/[qlist:(.*?)]/'

WBOY
Release: 2016-06-23 13:28:57
Original
1212 people have browsed it

$content = ‘[qlist:i]:[qlist:ID]’

        preg_match_all('/\[qlist:(.*?)\]/',$content,$arry);  
        $tag = $arry[0]; 
        $key = $arry[1];  

谁能给我解释下这个正则呢 为啥这个0 1 分别表示的是


[qlist:i] 和 i
[qlist:ID] 和 ID 


回复讨论(解决方案)

$content = '[qlist:i]:[qlist:ID]';preg_match_all('/\[qlist:(.*?)\]/',$content,$arry);print_r($arry);
Copy after login
Array(    [0] => Array     符合 \[qlist:(.*?)\] 的成分        (            [0] => [qlist:i]            [1] => [qlist:ID]        )    [1] => Array     第一个圆括号中匹配到的        (            [0] => i            [1] => ID        ))
Copy after login

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