cvs: phpdoc-zh /reference/pcre/functions pcre.pattern.syntax.xml preg-split.xml
| From: | Dallas Thunder | Date: | Mon, 15 Sep 2003 18:47:32 +0000 |
| Subject: | cvs: phpdoc-zh /reference/pcre/functions pcre.pattern.syntax.xml preg-split.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-1745@lists.php.net to get a copy of this message | ||
dallas Mon Sep 15 14:47:32 2003 EDT
Modified files:
/phpdoc-zh/reference/pcre/functions pcre.pattern.syntax.xml
preg-split.xml
Log:
Updated.
Index: phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml diff -u phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml:1.3 phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml:1.4 --- phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml:1.3 Tue Sep 9 21:39:55 2003 +++ phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml Mon Sep 15 14:47:32 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.5 Maintainer: dallas Status: partial --> <refentry id="pcre.pattern.syntax"> @@ -646,167 +646,114 @@ <refsect2 id="regexp.reference.circudollar"> <title>Òôµ÷·û£¨^£©ºÍÃÀÔª·û£¨$£©</title> - <literallayout> - Outside a character class, in the default matching mode, the - circumflex character is an assertion which is true only if - the current matching point is at the start of the subject - string. Inside a character class, circumflex has an entirely - different meaning (see below). - - Circumflex need not be the first character of the pattern if - a number of alternatives are involved, but it should be the - first thing in each alternative in which it appears if the - pattern is ever to match that branch. If all possible alter- - natives start with a circumflex, that is, if the pattern is - constrained to match only at the start of the subject, it is - said to be an "anchored" pattern. (There are also other con- - structs that can cause a pattern to be anchored.) - - A dollar character is an assertion which is &true; only if the - current matching point is at the end of the subject string, - or immediately before a newline character that is the last - character in the string (by default). Dollar need not be the - last character of the pattern if a number of alternatives - are involved, but it should be the last item in any branch - in which it appears. Dollar has no special meaning in a - character class. - - The meaning of dollar can be changed so that it matches only - at the very end of the string, by setting the - <link linkend="pcre.pattern.modifiers">PCRE_DOLLAR_ENDONLY</link> - option at compile or matching time. This - does not affect the \Z assertion. - - The meanings of the circumflex and dollar characters are - changed if the <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link> option is set. When this is - the case, they match immediately after and immediately - before an internal "\n" character, respectively, in addition - to matching at the start and end of the subject string. For - example, the pattern /^abc$/ matches the subject string - "def\nabc" in multiline mode, but not otherwise. Conse- - quently, patterns that are anchored in single line mode - because all branches start with "^" are not anchored in mul- - tiline mode. The <link linkend="pcre.pattern.modifiers">PCRE_DOLLAR_ENDONLY</link> option is ignored if - <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link> is set. - - Note that the sequences \A, \Z, and \z can be used to match - the start and end of the subject in both modes, and if all - branches of a pattern start with \A is it always anchored, - whether <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link> is set or not. - </literallayout> + <para> + ÔÚ×Ö·ûÀàÖ®Í⣬ĬÈÏÆ¥ÅäģʽÏ£¬Òôµ÷·ûÊÇÒ»¸ö½öÔÚµ±Ç°Æ¥ÅäµãÊÇÄ¿±ê×Ö·û´®µÄ¿ªÍ·Ê±²ÅÎªÕæµÄ¶ÏÑÔ¡£ÔÚ×Ö·ûÀàÖ®ÖУ¬Òôµ÷·ûµÄº¬ÒåÍêÈ«²»Í¬£¨¼ûÏÂÃæ£©¡£ + </para> + <para> + Èç¹ûÉæ¼°µ½¼¸Ñ¡Ò»Ê±Òôµ÷·û²»ÐèÒªÊÇģʽµÄµÚÒ»¸ö×Ö·û£¬µ«Èç¹û³öÏÖÔÚij¸ö·ÖÖ§ÖÐÔòÓ¦¸ÃÊǸÃÑ¡Ôñ·ÖÖ§µÄµÚÒ»¸ö×Ö·û¡£Èç¹ûËùÓеÄÑ¡Ôñ·ÖÖ§¶¼ÒÔÒôµ÷·û¿ªÍ·£¬Õâ¾ÍÊÇ˵£¬Èç¹ûģʽÏÞÖÆÎªÖ»Æ¥ÅäÄ¿±êµÄ¿ªÍ·£¬ÄÇôÕâÊÇÒ»¸ö½ô¹Ìģʽ¡££¨Ò²ÓÐÆäËü½á¹¹¿ÉÒÔʹģʽ³ÉΪ½ô¹ÌµÄ¡££© + </para> + <para> + ÃÀÔª·ûÊÇÒ»¸ö½öÔÚµ±Ç°Æ¥ÅäµãÊÇÄ¿±ê×Ö·û´®µÄ½áβ»òÕßµ±×îºóÒ»¸ö×Ö·ûÊÇ»»ÐзûʱÆäÇ°ÃæµÄλÖÃʱΪ + &true; µÄ¶ÏÑÔ£¨Ä¬ÈÏÇé¿öÏ£©¡£Èç¹ûÉæ¼°µ½¼¸Ñ¡Ò»Ê±ÃÀÔª·û²»ÐèÒªÊÇģʽµÄ×îºóÒ»¸ö×Ö·û£¬µ«Ó¦¸ÃÊÇÆä³öÏֵķÖÖ§ÖеÄ×îºóÒ»¸ö×Ö·û¡£ÃÀÔª·ûÔÚ×Ö·ûÀàÖ®ÖÐûÓÐÌØÊ⺬Òå¡£ + </para> + <para> + ÃÀÔª·ûµÄº¬Òå¿É±»¸Ä±äʹÆä½öÆ¥Åä×Ö·û´®µÄ½áβ£¬Ö»ÒªÔÚ±àÒë»òÆ¥ÅäʱÉ趨ÁË + <link linkend="pcre.pattern.modifiers">PCRE_DOLLAR_ENDONLY</link> + Ñ¡Ïî¼´¿É¡£Õâ²¢²»Ó°Ïì \Z ¶ÏÑÔ¡£ + </para> + <para> + Èç¹ûÉ趨ÁË + <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link> + Ñ¡ÏîÔòÒôµ÷·ûºÍÃÀÔª·ûµÄº¬Òå±»¸Ä±äÁË¡£´ËÖÖÇé¿öÏ£¬ËüÃÇ·Ö±ðÆ¥Åä½ô½Ó×ÅÄÚ²¿ + "\n" ×Ö·ûµÄÖ®ºóºÍ֮ǰ£¬ÔÙ¼ÓÉÏÄ¿±ê×Ö·û´®µÄ¿ªÍ·ºÍ½áβ¡£ÀýÈçģʽ + /^abc$/ ÔÚ¶àÐÐģʽÏÂÆ¥ÅäÁËÄ¿±ê×Ö·û´® + "def\nabc"£¬µ«Õý³£Ê±²»Æ¥Åä¡£Òò´Ë£¬ÓÉÓÚËùÓзÖÖ§¶¼ÒÔ + "^" ¿ªÍ·¶øÔÚµ¥ÐÐģʽϳÉΪ½ô¹ÌµÄģʽÔÚ¶àÐÐģʽÏÂΪ·Ç½ô¹ÌµÄ¡£Èç¹ûÉ趨ÁË + <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link>£¬Ôò + <link linkend="pcre.pattern.modifiers">PCRE_DOLLAR_ENDONLY</link> + Ñ¡Ïî»á±»ºöÂÔ¡£ + </para> + <para> + ×¢Òâ \A£¬\Z ºÍ \z ÐòÁÐÔÚÁ½ÖÖÇé¿ö϶¼¿ÉÒÔÓÃÀ´Æ¥ÅäÄ¿±êµÄ¿ªÍ·ºÍ½á⣬Èç¹ûģʽËùÓеķÖÖ§¶¼ÒÔ + \A ¿ªÊ¼ÔòÆä×ÜÊǽô¹ÌµÄ£¬²»ÂÛÊÇ·ñÉ趨ÁË + <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link>¡£ + </para> </refsect2> <refsect2 id="regexp.reference.dot"> - <title>FULL STOP</title> - <literallayout> - Outside a character class, a dot in the pattern matches any - one character in the subject, including a non-printing - character, but not (by default) newline. If the <link linkend="pcre.pattern.modifiers">PCRE_DOTALL</link> - option is set, then dots match newlines as well. The han- - dling of dot is entirely independent of the handling of cir- - cumflex and dollar, the only relationship being that they - both involve newline characters. Dot has no special meaning - in a character class. - </literallayout> + <title>¾äºÅ£¨.£©</title> + <para> + ÔÚ×Ö·ûÀàÖ®Í⣬ģʽÖеÄÔ²µã¿ÉÒÔÆ¥ÅäÄ¿±êÖеÄÈκÎÒ»¸ö×Ö·û£¬°üÀ¨²»¿É´òÓ¡×Ö·û£¬µ«²»Æ¥Åä»»Ðзû£¨Ä¬ÈÏÇé¿öÏ£©¡£Èç¹ûÉ趨ÁË + <link linkend="pcre.pattern.modifiers">PCRE_DOTALL</link> + ÔòÔ²µãÒ²»áÆ¥Åä»»Ðзû¡£´¦ÀíÔ²µãÓë´¦ÀíÒôµ÷·ûºÍÃÀÔª·ûÊÇÍêÈ«¶ÀÁ¢µÄ£¬Î¨Ò»µÄÁªÏµ¾ÍÊÇËüÃǶ¼Éæ¼°µ½»»Ðзû¡£Ô²µãÔÚ×Ö·ûÀàÖ®ÖÐûÓÐÌØÊ⺬Òå¡£ + </para> </refsect2> <refsect2 id="regexp.reference.squarebrackets"> - <title>Square brackets</title> - <literallayout> - An opening square bracket introduces a character class, ter- - minated by a closing square bracket. A closing square - bracket on its own is not special. If a closing square - bracket is required as a member of the class, it should be - the first data character in the class (after an initial cir- - cumflex, if present) or escaped with a backslash. - - A character class matches a single character in the subject; - the character must be in the set of characters defined by - the class, unless the first character in the class is a cir- - cumflex, in which case the subject character must not be in - the set defined by the class. If a circumflex is actually - required as a member of the class, ensure it is not the - first character, or escape it with a backslash. - - For example, the character class [aeiou] matches any lower - case vowel, while [^aeiou] matches any character that is not - a lower case vowel. Note that a circumflex is just a con- - venient notation for specifying the characters which are in - the class by enumerating those that are not. It is not an - assertion: it still consumes a character from the subject - string, and fails if the current pointer is at the end of - the string. - - When caseless matching is set, any letters in a class - represent both their upper case and lower case versions, so - for example, a caseless [aeiou] matches "A" as well as "a", - and a caseless [^aeiou] does not match "A", whereas a case- - ful version would. - - The newline character is never treated in any special way in - character classes, whatever the setting of the <link linkend="pcre.pattern.modifiers">PCRE_DOTALL</link> - or <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link> options is. A class such as [^a] will - always match a newline. - - The minus (hyphen) character can be used to specify a range - of characters in a character class. For example, [d-m] - matches any letter between d and m, inclusive. If a minus - character is required in a class, it must be escaped with a - backslash or appear in a position where it cannot be inter- - preted as indicating a range, typically as the first or last - character in the class. - - It is not possible to have the literal character "]" as the - end character of a range. A pattern such as [W-]46] is - interpreted as a class of two characters ("W" and "-") fol- - lowed by a literal string "46]", so it would match "W46]" or - "-46]". However, if the "]" is escaped with a backslash it - is interpreted as the end of range, so [W-\]46] is inter- - preted as a single class containing a range followed by two - separate characters. The octal or hexadecimal representation - of "]" can also be used to end a range. - - Ranges operate in ASCII collating sequence. They can also be - used for characters specified numerically, for example - [\000-\037]. If a range that includes letters is used when - caseless matching is set, it matches the letters in either - case. For example, [W-c] is equivalent to [][\^_`wxyzabc], - matched caselessly, and if character tables for the "fr" - locale are in use, [\xc8-\xcb] matches accented E characters - in both cases. - - The character types \d, \D, \s, \S, \w, and \W may also - appear in a character class, and add the characters that - they match to the class. For example, [\dABCDEF] matches any - hexadecimal digit. A circumflex can conveniently be used - with the upper case character types to specify a more res- - tricted set of characters than the matching lower case type. - For example, the class [^\W_] matches any letter or digit, - but not underscore. - - All non-alphanumeric characters other than \, -, ^ (at the - start) and the terminating ] are non-special in character - classes, but it does no harm if they are escaped. - </literallayout> + <title>·½À¨ºÅ£¨[]£©</title> + <para> + ×ó·½À¨ºÅ¿ªÊ¼ÁËÒ»¸ö×Ö·ûÀ࣬ÓÒ·½À¨ºÅ½áÊøÖ®¡£µ¥¶ÀÒ»¸öÓÒ·½À¨ºÅ²»ÊÇÌØÊâ×Ö·û¡£Èç¹ûÔÚ×Ö·ûÀàÖ®ÖÐÐèÒªÒ»¸öÓÒ·½À¨ºÅ£¬ÔòÆäÓ¦¸ÃÊÇ×Ö·ûÀàÖеĵÚÒ»¸ö×Ö·û£¨Èç¹ûÓÐÒôµ÷·ûµÄ»°£¬Ôò½ô½ÓÒôµ÷·ûÖ®ºó£©£¬»òÕßÓ÷´Ð±ÏßתÒå¡£ + </para> + <para> + ×Ö·ûÀàÆ¥ÅäÄ¿±êÖеÄÒ»¸ö×Ö·û£¬¸Ã×Ö·û±ØÐëÊÇ×Ö·ûÀඨÒåµÄ×Ö·û¼¯ÖеÄÒ»¸ö£»³ý·Ç×Ö·ûÀàÖеĵÚÒ»¸ö×Ö·ûÊÇÒôµ÷·û£¬´ËÇé¿öÏÂÄ¿±ê×Ö·û±ØÐë²»ÔÚ×Ö·ûÀඨÒåµÄ×Ö·û¼¯ÖС£Èç¹ûÔÚ×Ö·ûÀàÖÐÐèÒªÒôµ÷·û±¾Éí£¬ÔòÆä±ØÐë²»ÊǵÚÒ»¸ö×Ö·û£¬»òÓ÷´Ð±ÏßתÒå¡£ + </para> + <para> + ¾ÙÀý˵£¬×Ö·ûÀà [aeiou] Æ¥ÅäÁËÈκÎÒ»¸öСдԪÒô×Öĸ£¬¶ø [^aeiou] + Æ¥ÅäÁËÈκÎÒ»¸ö²»ÊÇСдԪÒô×ÖĸµÄ×Ö·û¡£×¢ÒâÒôµ÷·ûÖ»ÊÇÒ»¸öͨ¹ýö¾ÙÖ¸¶¨ÄÇЩ²»ÔÚ×Ö·ûÀàÖ®ÖеÄ×Ö·ûµÄ·ûºÅ¡£²»ÊǶÏÑÔ£ºÈԾɻáÏûºÄµôÄ¿±ê×Ö·û´®ÖеÄÒ»¸ö×Ö·û£¬Èç¹ûµ±Ç°Î»ÖÃÔÚ×Ö·û´®½áβµÄ»°Ôòʧ°Ü¡£ + </para> + <para> + µ±É趨Á˲»Çø·Ö´óСдµÄÆ¥Åäʱ£¬×Ö·ûÀàÖеÄÈκÎ×Öĸͬʱ´ú±íÁËÆä´óСдÐÎʽ£¬Òò´Ë¾ÙÀý˵£¬Ð¡Ð´µÄ + [aeiou] ͬʱƥÅäÁË "A" ºÍ "a"£¬Ð¡Ð´µÄ + [^aeiou] ²»Æ¥Åä "A"£¬µ«Çø·Ö´óСдʱÔò»áÆ¥Åä¡£ + </para> + <para> + »»ÐзûÔÚ×Ö·ûÀàÖв»»áÌØÊâ¶Ô´ý£¬²»ÂÛ + <link linkend="pcre.pattern.modifiers">PCRE_DOTALL</link> »òÕß + <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link> + Ñ¡ÏîÉ趨ÁËʲôֵ¡£ÐÎÈç [^a] µÄ×Ö·ûÀà×ÜÊÇÄܹ»ºÍ»»ÐзûÏàÆ¥ÅäµÄ¡£ + </para> + <para> + ¼õºÅ£¨-£©×Ö·û¿ÉÒÔÔÚ×Ö·ûÀàÖÐÖ¸¶¨Ò»¸ö×Ö·û·¶Î§¡£ÀýÈ磬[d-m] + Æ¥ÅäÁË d ºÍ m Ö®¼äµÄÈκÎ×Ö·û£¬°üÀ¨Á½Õß¡£Èç¹û×Ö·ûÀàÖÐÐèÒª¼õºÅ±¾Éí£¬Ôò±ØÐëÓ÷´Ð±ÏßתÒå»òÕ߷ŵ½Ò»¸ö²»Äܱ»½âÊÍΪָ¶¨·¶Î§µÄλÖ㬵äÐ͵ÄλÖÃÊÇ×Ö·ûÀàÖеĵÚÒ»¸ö»ò×îºóÒ»¸ö×Ö·û¡£ + </para> + <para> + ×ÖÃæÉ쵀 "]" ²»¿ÉÄܱ»µ±³É×Ö·û·¶Î§µÄ½áÊø¡£ÐÎÈç + [W-]46] µÄģʽ»á±»½âÊÍΪ°üÀ¨Á½¸ö×Ö·ûµÄ×Ö·ûÀࣨ"W" and "-"£©ºóÃæ¸ú×Å×Ö·û´® + "46]"£¬Òò´ËÆä»áÆ¥Åä "W46]" »òÕß "-46]"¡£È»¶ø£¬Èç¹û½« + "]" Ó÷´Ð±ÏßתÒ壬Ôò»á±»µ±³É·¶Î§µÄ½áÊøÀ´½âÊÍ¡£Òò´Ë + [W-\]46] »á±»½âÊÍΪһ¸ö×Ö·ûÀ࣬°üº¬ÓÐÒ»¸ö·¶Î§ÒÔ¼°Á½¸öµ¥¶ÀµÄ×Ö·û¡£°Ë½øÖÆ»òÊ®Áù½øÖƱíʾµÄ + "]" Ò²¿ÉÒÔÓÃÀ´±íʾ·¶Î§µÄ½áÊø¡£ + </para> + <para> + ·¶Î§ÊÇÒÔ ASCII ±È½Ï˳ÐòÀ´²Ù×÷µÄ¡£Ò²¿ÉÒÔÓÃÓÚÓÃÊý×Ö±íʾµÄ×Ö·û£¬ÀýÈç + [\000-\037]¡£ÔÚ²»Çø·Ö´óСдƥÅäÖÐÈç¹û·¶Î§Àï°üÀ¨ÁË×Öĸ£¬ÔòͬʱƥÅä´óСд×Öĸ¡£ÀýÈç + [W-c] µÈ¼ÛÓÚ [][\^_`wxyzabc] ²»Çø·Ö´óСдµØÆ¥Åä¡£Èç¹ûʹÓÃÁË + "fr" ÇøÓòµÄ×Ö·û±í£¬[\xc8-\xcb] Æ¥ÅäÁË´óСдµÄÖØÒô E ×Ö·û¡£ + </para> + <para> + ×Ö·ûÀàÐÍ \d£¬\D£¬\s£¬\S£¬\w ºÍ \W + Ò²¿ÉÒÔ³öÏÖÓÚ×Ö·ûÀàÖУ¬²¢½«ÆäËùÄÜÆ¥ÅäµÄ×Ö·ûÌí¼Ó½ø×Ö·ûÀàÖС£ÀýÈ磬[\dABCDEF] + Æ¥ÅäÁËÈκÎÊ®Áù½øÖÆÊý×Ö¡£ÓÃÒôµ÷·û¿ÉÒԺܷ½±ãµØÖƶ¨ÑϸñµÄ×Ö·û¼¯£¬ÀýÈç + [^\W_] Æ¥ÅäÁËÈκÎ×Öĸ»òÊý×Ö£¬µ«²»Æ¥ÅäÏ»®Ïß¡£ + </para> + <para> + ÈκγýÁË \£¬-£¬^£¨Î»ÓÚ¿ªÍ·£©ÒÔ¼°½áÊøµÄ ] + Ö®ÍâµÄ·Ç×ÖĸÊý×Ö×Ö·ûÔÚ×Ö·ûÀàÖж¼Ã»ÓÐÌØÊ⺬Ò壬µ«Êǽ«ËüÃÇתÒåҲûÓлµ´¦¡£ + </para> </refsect2> <refsect2 id="regexp.reference.verticalbar"> - <title>Vertical bar</title> - <literallayout> - Vertical bar characters are used to separate alternative - patterns. For example, the pattern - + <title>ÊúÏߣ¨|£©</title> + <para> + ÊúÏß×Ö·ûÓÃÀ´·Ö¸ô¶àѡһģʽ¡£ÀýÈ磬ģʽ£º + <screen> +<![CDATA[ gilbert|sullivan - - matches either "gilbert" or "sullivan". Any number of alternatives - may appear, and an empty alternative is permitted - (matching the empty string). The matching process tries - each alternative in turn, from left to right, and the first - one that succeeds is used. If the alternatives are within a - subpattern (defined below), "succeeds" means matching the - rest of the main pattern as well as the alternative in the - subpattern. - </literallayout> +]]> + </screen> + Æ¥ÅäÁË "gilbert" »òÕß "sullivan" + ÖеÄÒ»¸ö¡£¿ÉÒÔÓÐÈÎÒâ¶à¸ö·ÖÖ§£¬Ò²¿ÉÒÔÓпյķÖÖ§£¨Æ¥Åä¿Õ×Ö·û´®£©¡£Æ¥Åä½ø³Ì´Ó×óµ½ÓÒÂÖÁ÷³¢ÊÔÿ¸ö·ÖÖ§£¬²¢Ê¹ÓõÚÒ»¸ö³É¹¦Æ¥ÅäµÄ·ÖÖ§¡£Èç¹û·ÖÖ§ÔÚ×Óģʽ£¨ÔÚÏÂÃæ¶¨Ò壩ÖУ¬Ôò¡°³É¹¦Æ¥Å䡱±íʾͬʱƥÅäÁË×ÓģʽÖеķÖÖ§ÒÔ¼°Ö÷ģʽµÄÆäËü²¿·Ö¡£ + </para> </refsect2> <refsect2 id="regexp.reference.internal-options"> Index: phpdoc-zh/reference/pcre/functions/preg-split.xml diff -u phpdoc-zh/reference/pcre/functions/preg-split.xml:1.1 phpdoc-zh/reference/pcre/functions/preg-split.xml:1.2 --- phpdoc-zh/reference/pcre/functions/preg-split.xml:1.1 Thu Sep 4 17:24:02 2003 +++ phpdoc-zh/reference/pcre/functions/preg-split.xml Mon Sep 15 14:47:32 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.7 Maintainer: dallas Status: ready --> <refentry id="function.preg-split"> @@ -137,7 +137,7 @@ </para> </note> <para> - ²Î¼û <function>spliti</function>, <function>split</function>£¬<function>implode</function>, <function>preg_match</function>£¬<function>preg_match_all</function> + ²Î¼û <function>spliti</function>£¬<function>split</function>£¬<function>implode</function>£¬<function>preg_match</function>£¬<function>preg_match_all</function> ºÍ <function>preg_replace</function>¡£ </para> </refsect1>
Index: phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml diff -u phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml:1.3 phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml:1.4 --- phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml:1.3 Tue Sep 9 21:39:55 2003 +++ phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml Mon Sep 15 14:47:32 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.5 Maintainer: dallas Status: partial --> <refentry id="pcre.pattern.syntax"> @@ -646,167 +646,114 @@ <refsect2 id="regexp.reference.circudollar"> <title>Òôµ÷·û£¨^£©ºÍÃÀÔª·û£¨$£©</title> - <literallayout> - Outside a character class, in the default matching mode, the - circumflex character is an assertion which is true only if - the current matching point is at the start of the subject - string. Inside a character class, circumflex has an entirely - different meaning (see below). - - Circumflex need not be the first character of the pattern if - a number of alternatives are involved, but it should be the - first thing in each alternative in which it appears if the - pattern is ever to match that branch. If all possible alter- - natives start with a circumflex, that is, if the pattern is - constrained to match only at the start of the subject, it is - said to be an "anchored" pattern. (There are also other con- - structs that can cause a pattern to be anchored.) - - A dollar character is an assertion which is &true; only if the - current matching point is at the end of the subject string, - or immediately before a newline character that is the last - character in the string (by default). Dollar need not be the - last character of the pattern if a number of alternatives - are involved, but it should be the last item in any branch - in which it appears. Dollar has no special meaning in a - character class. - - The meaning of dollar can be changed so that it matches only - at the very end of the string, by setting the - <link linkend="pcre.pattern.modifiers">PCRE_DOLLAR_ENDONLY</link> - option at compile or matching time. This - does not affect the \Z assertion. - - The meanings of the circumflex and dollar characters are - changed if the <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link> option is set. When this is - the case, they match immediately after and immediately - before an internal "\n" character, respectively, in addition - to matching at the start and end of the subject string. For - example, the pattern /^abc$/ matches the subject string - "def\nabc" in multiline mode, but not otherwise. Conse- - quently, patterns that are anchored in single line mode - because all branches start with "^" are not anchored in mul- - tiline mode. The <link linkend="pcre.pattern.modifiers">PCRE_DOLLAR_ENDONLY</link> option is ignored if - <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link> is set. - - Note that the sequences \A, \Z, and \z can be used to match - the start and end of the subject in both modes, and if all - branches of a pattern start with \A is it always anchored, - whether <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link> is set or not. - </literallayout> + <para> + ÔÚ×Ö·ûÀàÖ®Í⣬ĬÈÏÆ¥ÅäģʽÏ£¬Òôµ÷·ûÊÇÒ»¸ö½öÔÚµ±Ç°Æ¥ÅäµãÊÇÄ¿±ê×Ö·û´®µÄ¿ªÍ·Ê±²ÅÎªÕæµÄ¶ÏÑÔ¡£ÔÚ×Ö·ûÀàÖ®ÖУ¬Òôµ÷·ûµÄº¬ÒåÍêÈ«²»Í¬£¨¼ûÏÂÃæ£©¡£ + </para> + <para> + Èç¹ûÉæ¼°µ½¼¸Ñ¡Ò»Ê±Òôµ÷·û²»ÐèÒªÊÇģʽµÄµÚÒ»¸ö×Ö·û£¬µ«Èç¹û³öÏÖÔÚij¸ö·ÖÖ§ÖÐÔòÓ¦¸ÃÊǸÃÑ¡Ôñ·ÖÖ§µÄµÚÒ»¸ö×Ö·û¡£Èç¹ûËùÓеÄÑ¡Ôñ·ÖÖ§¶¼ÒÔÒôµ÷·û¿ªÍ·£¬Õâ¾ÍÊÇ˵£¬Èç¹ûģʽÏÞÖÆÎªÖ»Æ¥ÅäÄ¿±êµÄ¿ªÍ·£¬ÄÇôÕâÊÇÒ»¸ö½ô¹Ìģʽ¡££¨Ò²ÓÐÆäËü½á¹¹¿ÉÒÔʹģʽ³ÉΪ½ô¹ÌµÄ¡££© + </para> + <para> + ÃÀÔª·ûÊÇÒ»¸ö½öÔÚµ±Ç°Æ¥ÅäµãÊÇÄ¿±ê×Ö·û´®µÄ½áβ»òÕßµ±×îºóÒ»¸ö×Ö·ûÊÇ»»ÐзûʱÆäÇ°ÃæµÄλÖÃʱΪ + &true; µÄ¶ÏÑÔ£¨Ä¬ÈÏÇé¿öÏ£©¡£Èç¹ûÉæ¼°µ½¼¸Ñ¡Ò»Ê±ÃÀÔª·û²»ÐèÒªÊÇģʽµÄ×îºóÒ»¸ö×Ö·û£¬µ«Ó¦¸ÃÊÇÆä³öÏֵķÖÖ§ÖеÄ×îºóÒ»¸ö×Ö·û¡£ÃÀÔª·ûÔÚ×Ö·ûÀàÖ®ÖÐûÓÐÌØÊ⺬Òå¡£ + </para> + <para> + ÃÀÔª·ûµÄº¬Òå¿É±»¸Ä±äʹÆä½öÆ¥Åä×Ö·û´®µÄ½áβ£¬Ö»ÒªÔÚ±àÒë»òÆ¥ÅäʱÉ趨ÁË + <link linkend="pcre.pattern.modifiers">PCRE_DOLLAR_ENDONLY</link> + Ñ¡Ïî¼´¿É¡£Õâ²¢²»Ó°Ïì \Z ¶ÏÑÔ¡£ + </para> + <para> + Èç¹ûÉ趨ÁË + <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link> + Ñ¡ÏîÔòÒôµ÷·ûºÍÃÀÔª·ûµÄº¬Òå±»¸Ä±äÁË¡£´ËÖÖÇé¿öÏ£¬ËüÃÇ·Ö±ðÆ¥Åä½ô½Ó×ÅÄÚ²¿ + "\n" ×Ö·ûµÄÖ®ºóºÍ֮ǰ£¬ÔÙ¼ÓÉÏÄ¿±ê×Ö·û´®µÄ¿ªÍ·ºÍ½áβ¡£ÀýÈçģʽ + /^abc$/ ÔÚ¶àÐÐģʽÏÂÆ¥ÅäÁËÄ¿±ê×Ö·û´® + "def\nabc"£¬µ«Õý³£Ê±²»Æ¥Åä¡£Òò´Ë£¬ÓÉÓÚËùÓзÖÖ§¶¼ÒÔ + "^" ¿ªÍ·¶øÔÚµ¥ÐÐģʽϳÉΪ½ô¹ÌµÄģʽÔÚ¶àÐÐģʽÏÂΪ·Ç½ô¹ÌµÄ¡£Èç¹ûÉ趨ÁË + <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link>£¬Ôò + <link linkend="pcre.pattern.modifiers">PCRE_DOLLAR_ENDONLY</link> + Ñ¡Ïî»á±»ºöÂÔ¡£ + </para> + <para> + ×¢Òâ \A£¬\Z ºÍ \z ÐòÁÐÔÚÁ½ÖÖÇé¿ö϶¼¿ÉÒÔÓÃÀ´Æ¥ÅäÄ¿±êµÄ¿ªÍ·ºÍ½á⣬Èç¹ûģʽËùÓеķÖÖ§¶¼ÒÔ + \A ¿ªÊ¼ÔòÆä×ÜÊǽô¹ÌµÄ£¬²»ÂÛÊÇ·ñÉ趨ÁË + <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link>¡£ + </para> </refsect2> <refsect2 id="regexp.reference.dot"> - <title>FULL STOP</title> - <literallayout> - Outside a character class, a dot in the pattern matches any - one character in the subject, including a non-printing - character, but not (by default) newline. If the <link linkend="pcre.pattern.modifiers">PCRE_DOTALL</link> - option is set, then dots match newlines as well. The han- - dling of dot is entirely independent of the handling of cir- - cumflex and dollar, the only relationship being that they - both involve newline characters. Dot has no special meaning - in a character class. - </literallayout> + <title>¾äºÅ£¨.£©</title> + <para> + ÔÚ×Ö·ûÀàÖ®Í⣬ģʽÖеÄÔ²µã¿ÉÒÔÆ¥ÅäÄ¿±êÖеÄÈκÎÒ»¸ö×Ö·û£¬°üÀ¨²»¿É´òÓ¡×Ö·û£¬µ«²»Æ¥Åä»»Ðзû£¨Ä¬ÈÏÇé¿öÏ£©¡£Èç¹ûÉ趨ÁË + <link linkend="pcre.pattern.modifiers">PCRE_DOTALL</link> + ÔòÔ²µãÒ²»áÆ¥Åä»»Ðзû¡£´¦ÀíÔ²µãÓë´¦ÀíÒôµ÷·ûºÍÃÀÔª·ûÊÇÍêÈ«¶ÀÁ¢µÄ£¬Î¨Ò»µÄÁªÏµ¾ÍÊÇËüÃǶ¼Éæ¼°µ½»»Ðзû¡£Ô²µãÔÚ×Ö·ûÀàÖ®ÖÐûÓÐÌØÊ⺬Òå¡£ + </para> </refsect2> <refsect2 id="regexp.reference.squarebrackets"> - <title>Square brackets</title> - <literallayout> - An opening square bracket introduces a character class, ter- - minated by a closing square bracket. A closing square - bracket on its own is not special. If a closing square - bracket is required as a member of the class, it should be - the first data character in the class (after an initial cir- - cumflex, if present) or escaped with a backslash. - - A character class matches a single character in the subject; - the character must be in the set of characters defined by - the class, unless the first character in the class is a cir- - cumflex, in which case the subject character must not be in - the set defined by the class. If a circumflex is actually - required as a member of the class, ensure it is not the - first character, or escape it with a backslash. - - For example, the character class [aeiou] matches any lower - case vowel, while [^aeiou] matches any character that is not - a lower case vowel. Note that a circumflex is just a con- - venient notation for specifying the characters which are in - the class by enumerating those that are not. It is not an - assertion: it still consumes a character from the subject - string, and fails if the current pointer is at the end of - the string. - - When caseless matching is set, any letters in a class - represent both their upper case and lower case versions, so - for example, a caseless [aeiou] matches "A" as well as "a", - and a caseless [^aeiou] does not match "A", whereas a case- - ful version would. - - The newline character is never treated in any special way in - character classes, whatever the setting of the <link linkend="pcre.pattern.modifiers">PCRE_DOTALL</link> - or <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link> options is. A class such as [^a] will - always match a newline. - - The minus (hyphen) character can be used to specify a range - of characters in a character class. For example, [d-m] - matches any letter between d and m, inclusive. If a minus - character is required in a class, it must be escaped with a - backslash or appear in a position where it cannot be inter- - preted as indicating a range, typically as the first or last - character in the class. - - It is not possible to have the literal character "]" as the - end character of a range. A pattern such as [W-]46] is - interpreted as a class of two characters ("W" and "-") fol- - lowed by a literal string "46]", so it would match "W46]" or - "-46]". However, if the "]" is escaped with a backslash it - is interpreted as the end of range, so [W-\]46] is inter- - preted as a single class containing a range followed by two - separate characters. The octal or hexadecimal representation - of "]" can also be used to end a range. - - Ranges operate in ASCII collating sequence. They can also be - used for characters specified numerically, for example - [\000-\037]. If a range that includes letters is used when - caseless matching is set, it matches the letters in either - case. For example, [W-c] is equivalent to [][\^_`wxyzabc], - matched caselessly, and if character tables for the "fr" - locale are in use, [\xc8-\xcb] matches accented E characters - in both cases. - - The character types \d, \D, \s, \S, \w, and \W may also - appear in a character class, and add the characters that - they match to the class. For example, [\dABCDEF] matches any - hexadecimal digit. A circumflex can conveniently be used - with the upper case character types to specify a more res- - tricted set of characters than the matching lower case type. - For example, the class [^\W_] matches any letter or digit, - but not underscore. - - All non-alphanumeric characters other than \, -, ^ (at the - start) and the terminating ] are non-special in character - classes, but it does no harm if they are escaped. - </literallayout> + <title>·½À¨ºÅ£¨[]£©</title> + <para> + ×ó·½À¨ºÅ¿ªÊ¼ÁËÒ»¸ö×Ö·ûÀ࣬ÓÒ·½À¨ºÅ½áÊøÖ®¡£µ¥¶ÀÒ»¸öÓÒ·½À¨ºÅ²»ÊÇÌØÊâ×Ö·û¡£Èç¹ûÔÚ×Ö·ûÀàÖ®ÖÐÐèÒªÒ»¸öÓÒ·½À¨ºÅ£¬ÔòÆäÓ¦¸ÃÊÇ×Ö·ûÀàÖеĵÚÒ»¸ö×Ö·û£¨Èç¹ûÓÐÒôµ÷·ûµÄ»°£¬Ôò½ô½ÓÒôµ÷·ûÖ®ºó£©£¬»òÕßÓ÷´Ð±ÏßתÒå¡£ + </para> + <para> + ×Ö·ûÀàÆ¥ÅäÄ¿±êÖеÄÒ»¸ö×Ö·û£¬¸Ã×Ö·û±ØÐëÊÇ×Ö·ûÀඨÒåµÄ×Ö·û¼¯ÖеÄÒ»¸ö£»³ý·Ç×Ö·ûÀàÖеĵÚÒ»¸ö×Ö·ûÊÇÒôµ÷·û£¬´ËÇé¿öÏÂÄ¿±ê×Ö·û±ØÐë²»ÔÚ×Ö·ûÀඨÒåµÄ×Ö·û¼¯ÖС£Èç¹ûÔÚ×Ö·ûÀàÖÐÐèÒªÒôµ÷·û±¾Éí£¬ÔòÆä±ØÐë²»ÊǵÚÒ»¸ö×Ö·û£¬»òÓ÷´Ð±ÏßתÒå¡£ + </para> + <para> + ¾ÙÀý˵£¬×Ö·ûÀà [aeiou] Æ¥ÅäÁËÈκÎÒ»¸öСдԪÒô×Öĸ£¬¶ø [^aeiou] + Æ¥ÅäÁËÈκÎÒ»¸ö²»ÊÇСдԪÒô×ÖĸµÄ×Ö·û¡£×¢ÒâÒôµ÷·ûÖ»ÊÇÒ»¸öͨ¹ýö¾ÙÖ¸¶¨ÄÇЩ²»ÔÚ×Ö·ûÀàÖ®ÖеÄ×Ö·ûµÄ·ûºÅ¡£²»ÊǶÏÑÔ£ºÈԾɻáÏûºÄµôÄ¿±ê×Ö·û´®ÖеÄÒ»¸ö×Ö·û£¬Èç¹ûµ±Ç°Î»ÖÃÔÚ×Ö·û´®½áβµÄ»°Ôòʧ°Ü¡£ + </para> + <para> + µ±É趨Á˲»Çø·Ö´óСдµÄÆ¥Åäʱ£¬×Ö·ûÀàÖеÄÈκÎ×Öĸͬʱ´ú±íÁËÆä´óСдÐÎʽ£¬Òò´Ë¾ÙÀý˵£¬Ð¡Ð´µÄ + [aeiou] ͬʱƥÅäÁË "A" ºÍ "a"£¬Ð¡Ð´µÄ + [^aeiou] ²»Æ¥Åä "A"£¬µ«Çø·Ö´óСдʱÔò»áÆ¥Åä¡£ + </para> + <para> + »»ÐзûÔÚ×Ö·ûÀàÖв»»áÌØÊâ¶Ô´ý£¬²»ÂÛ + <link linkend="pcre.pattern.modifiers">PCRE_DOTALL</link> »òÕß + <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link> + Ñ¡ÏîÉ趨ÁËʲôֵ¡£ÐÎÈç [^a] µÄ×Ö·ûÀà×ÜÊÇÄܹ»ºÍ»»ÐзûÏàÆ¥ÅäµÄ¡£ + </para> + <para> + ¼õºÅ£¨-£©×Ö·û¿ÉÒÔÔÚ×Ö·ûÀàÖÐÖ¸¶¨Ò»¸ö×Ö·û·¶Î§¡£ÀýÈ磬[d-m] + Æ¥ÅäÁË d ºÍ m Ö®¼äµÄÈκÎ×Ö·û£¬°üÀ¨Á½Õß¡£Èç¹û×Ö·ûÀàÖÐÐèÒª¼õºÅ±¾Éí£¬Ôò±ØÐëÓ÷´Ð±ÏßתÒå»òÕ߷ŵ½Ò»¸ö²»Äܱ»½âÊÍΪָ¶¨·¶Î§µÄλÖ㬵äÐ͵ÄλÖÃÊÇ×Ö·ûÀàÖеĵÚÒ»¸ö»ò×îºóÒ»¸ö×Ö·û¡£ + </para> + <para> + ×ÖÃæÉ쵀 "]" ²»¿ÉÄܱ»µ±³É×Ö·û·¶Î§µÄ½áÊø¡£ÐÎÈç + [W-]46] µÄģʽ»á±»½âÊÍΪ°üÀ¨Á½¸ö×Ö·ûµÄ×Ö·ûÀࣨ"W" and "-"£©ºóÃæ¸ú×Å×Ö·û´® + "46]"£¬Òò´ËÆä»áÆ¥Åä "W46]" »òÕß "-46]"¡£È»¶ø£¬Èç¹û½« + "]" Ó÷´Ð±ÏßתÒ壬Ôò»á±»µ±³É·¶Î§µÄ½áÊøÀ´½âÊÍ¡£Òò´Ë + [W-\]46] »á±»½âÊÍΪһ¸ö×Ö·ûÀ࣬°üº¬ÓÐÒ»¸ö·¶Î§ÒÔ¼°Á½¸öµ¥¶ÀµÄ×Ö·û¡£°Ë½øÖÆ»òÊ®Áù½øÖƱíʾµÄ + "]" Ò²¿ÉÒÔÓÃÀ´±íʾ·¶Î§µÄ½áÊø¡£ + </para> + <para> + ·¶Î§ÊÇÒÔ ASCII ±È½Ï˳ÐòÀ´²Ù×÷µÄ¡£Ò²¿ÉÒÔÓÃÓÚÓÃÊý×Ö±íʾµÄ×Ö·û£¬ÀýÈç + [\000-\037]¡£ÔÚ²»Çø·Ö´óСдƥÅäÖÐÈç¹û·¶Î§Àï°üÀ¨ÁË×Öĸ£¬ÔòͬʱƥÅä´óСд×Öĸ¡£ÀýÈç + [W-c] µÈ¼ÛÓÚ [][\^_`wxyzabc] ²»Çø·Ö´óСдµØÆ¥Åä¡£Èç¹ûʹÓÃÁË + "fr" ÇøÓòµÄ×Ö·û±í£¬[\xc8-\xcb] Æ¥ÅäÁË´óСдµÄÖØÒô E ×Ö·û¡£ + </para> + <para> + ×Ö·ûÀàÐÍ \d£¬\D£¬\s£¬\S£¬\w ºÍ \W + Ò²¿ÉÒÔ³öÏÖÓÚ×Ö·ûÀàÖУ¬²¢½«ÆäËùÄÜÆ¥ÅäµÄ×Ö·ûÌí¼Ó½ø×Ö·ûÀàÖС£ÀýÈ磬[\dABCDEF] + Æ¥ÅäÁËÈκÎÊ®Áù½øÖÆÊý×Ö¡£ÓÃÒôµ÷·û¿ÉÒԺܷ½±ãµØÖƶ¨ÑϸñµÄ×Ö·û¼¯£¬ÀýÈç + [^\W_] Æ¥ÅäÁËÈκÎ×Öĸ»òÊý×Ö£¬µ«²»Æ¥ÅäÏ»®Ïß¡£ + </para> + <para> + ÈκγýÁË \£¬-£¬^£¨Î»ÓÚ¿ªÍ·£©ÒÔ¼°½áÊøµÄ ] + Ö®ÍâµÄ·Ç×ÖĸÊý×Ö×Ö·ûÔÚ×Ö·ûÀàÖж¼Ã»ÓÐÌØÊ⺬Ò壬µ«Êǽ«ËüÃÇתÒåҲûÓлµ´¦¡£ + </para> </refsect2> <refsect2 id="regexp.reference.verticalbar"> - <title>Vertical bar</title> - <literallayout> - Vertical bar characters are used to separate alternative - patterns. For example, the pattern - + <title>ÊúÏߣ¨|£©</title> + <para> + ÊúÏß×Ö·ûÓÃÀ´·Ö¸ô¶àѡһģʽ¡£ÀýÈ磬ģʽ£º + <screen> +<![CDATA[ gilbert|sullivan - - matches either "gilbert" or "sullivan". Any number of alternatives - may appear, and an empty alternative is permitted - (matching the empty string). The matching process tries - each alternative in turn, from left to right, and the first - one that succeeds is used. If the alternatives are within a - subpattern (defined below), "succeeds" means matching the - rest of the main pattern as well as the alternative in the - subpattern. - </literallayout> +]]> + </screen> + Æ¥ÅäÁË "gilbert" »òÕß "sullivan" + ÖеÄÒ»¸ö¡£¿ÉÒÔÓÐÈÎÒâ¶à¸ö·ÖÖ§£¬Ò²¿ÉÒÔÓпյķÖÖ§£¨Æ¥Åä¿Õ×Ö·û´®£©¡£Æ¥Åä½ø³Ì´Ó×óµ½ÓÒÂÖÁ÷³¢ÊÔÿ¸ö·ÖÖ§£¬²¢Ê¹ÓõÚÒ»¸ö³É¹¦Æ¥ÅäµÄ·ÖÖ§¡£Èç¹û·ÖÖ§ÔÚ×Óģʽ£¨ÔÚÏÂÃæ¶¨Ò壩ÖУ¬Ôò¡°³É¹¦Æ¥Å䡱±íʾͬʱƥÅäÁË×ÓģʽÖеķÖÖ§ÒÔ¼°Ö÷ģʽµÄÆäËü²¿·Ö¡£ + </para> </refsect2> <refsect2 id="regexp.reference.internal-options"> Index: phpdoc-zh/reference/pcre/functions/preg-split.xml diff -u phpdoc-zh/reference/pcre/functions/preg-split.xml:1.1 phpdoc-zh/reference/pcre/functions/preg-split.xml:1.2 --- phpdoc-zh/reference/pcre/functions/preg-split.xml:1.1 Thu Sep 4 17:24:02 2003 +++ phpdoc-zh/reference/pcre/functions/preg-split.xml Mon Sep 15 14:47:32 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.7 Maintainer: dallas Status: ready --> <refentry id="function.preg-split"> @@ -137,7 +137,7 @@ </para> </note> <para> - ²Î¼û <function>spliti</function>, <function>split</function>£¬<function>implode</function>, <function>preg_match</function>£¬<function>preg_match_all</function> + ²Î¼û <function>spliti</function>£¬<function>split</function>£¬<function>implode</function>£¬<function>preg_match</function>£¬<function>preg_match_all</function> ºÍ <function>preg_replace</function>¡£ </para> </refsect1>