作者kong0107 (阿空)
看板PHP
标题Re: [请益] PCRE 看不懂..
时间Tue Mar 20 14:21:40 2007
※ 引述《ialk (175)》之铭言:
: 接着那串/\s*({$quote}?)(.*?)\\1\s*(?:{$delim}|$)/
: ^^^^^^^^
: 请问这段是什麽意思 ?
(.*?)的部份....
. 是"不含换行的任何字元"
* 是"零次以上"
? 是"零或一个"
其他请google正规表示法
\\1的部分我在
http://php.nctu.edu.tw/manual/en/function.ereg-replace.php 查到
If pattern contains parenthesized substrings, replacement may contain
substrings of the form \\digit, which will be replaced by the text matching
the digit'th parenthesized substring; \\0 will produce the entire contents of
string. Up to nine substrings may be used. Parentheses may be nested, in
which case they are counted by the opening parenthesis.
: 最後的matches[2]又是什麽 @@
同样根据官网
http://php.nctu.edu.tw/manual/en/function.preg-match-all.php
$matches[0] is the first set of matches, and $matches[0][0] has text matched
by full pattern, $matches[0][1] has text matched by first subpattern and so
on. Similarly, $matches[1] is the second set of matches, etc.
--
只要抓住他那根尾巴
就可以让他服服贴贴的
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.104.57.62
1F:→ kong0107:可是为什麽在'*'的後面又放了'?'呀? 03/20 14:22
2F:推 alpe:在这个版扫"正规" 这两个字, 你就可以看到够多中文资料了 03/20 15:53
3F:推 ialk:感谢:p 03/20 16:35