作者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
→ kong0107:可是為什麼在'*'的後面又放了'?'呀? 03/20 14:22
推 alpe:在這個版掃"正規" 這兩個字, 你就可以看到夠多中文資料了 03/20 15:53
推 ialk:感謝:p 03/20 16:35