Re: [請益] PCRE 看不懂..
※ 引述《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
→
03/20 14:22, , 1F
03/20 14:22, 1F
推
03/20 15:53, , 2F
03/20 15:53, 2F
推
03/20 16:35, , 3F
03/20 16:35, 3F
討論串 (同標題文章)
PHP 近期熱門文章
PTT數位生活區 即時熱門文章