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

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

WBOY
WBOYOriginal
2016-06-23 13:28:571214browse

$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);
Array(    [0] => Array     符合 \[qlist:(.*?)\] 的成分        (            [0] => [qlist:i]            [1] => [qlist:ID]        )    [1] => Array     第一个圆括号中匹配到的        (            [0] => i            [1] => ID        ))

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