cvs: phpdoc-zh /reference/pcre/functions pcre.pattern.syntax.xml
| From: | Dallas Thunder | Date: | Wed, 10 Sep 2003 01:39:55 +0000 |
| Subject: | cvs: phpdoc-zh /reference/pcre/functions pcre.pattern.syntax.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-1736@lists.php.net to get a copy of this message | ||
dallas Tue Sep 9 21:39:55 2003 EDT
Modified files:
/phpdoc-zh/reference/pcre/functions pcre.pattern.syntax.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.2 phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml:1.3 --- phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml:1.2 Fri Sep 5 18:26:05 2003 +++ phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml Tue Sep 9 21:39:55 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.5 Maintainer: dallas Status: partial --> <refentry id="pcre.pattern.syntax"> @@ -34,9 +34,9 @@ </listitem> <listitem> <simpara> - PCRE ²»ÔÊÐíÏòǰƥÅäÖØ¸´µÄÊýÁ¿·û¡£Perl + PCRE ²»ÔÊÐíÔÚÏòǰ¶ÏÑÔÖÐʹÓÃÖØ¸´µÄÊýÁ¿·û¡£Perl ÔÊÐíÕâÑù£¬µ«¿ÉÄܲ»ÊÇÄãÏëÏóÖеĺ¬Òå¡£ÀýÈ磬(?!a){3} - ²¢²»Æ¥ÅäÏÂÃæÈý¸ö²»ÊÇ¡°a¡±µÄ×Ö·û£¬¶øÊÇÆ¥ÅäÏÂÒ»¸ö²»ÊÇ¡°a¡±µÄ×Ö·ûÈý´Î¡£ + ²¢²»ÊǶÏÑÔÏÂÃæÈý¸ö×Ö·û²»ÊÇ¡°a¡±£¬¶øÊǶÏÑÔÏÂÒ»¸ö×Ö·û²»ÊÇ¡°a¡±Èý´Î¡£ </simpara> </listitem> <listitem> @@ -68,7 +68,7 @@ </listitem> <listitem> <simpara> - ²»Ö§³Ö Perl µÄ \G Æ¥Å䣬ÒòΪÕâºÍµ¥¸öµÄģʽƥÅäÎ޹ء£ + ²»Ö§³Ö Perl µÄ \G ¶ÏÑÔ£¬ÒòΪÕâºÍµ¥¸öµÄģʽƥÅäÎ޹ء£ </simpara> </listitem> <listitem> @@ -136,40 +136,26 @@ <refsect1 id="regexp.reference"> <title>ÕýÔò±í´ïʽÏê½â</title> - <refsect2 id="regexp.introduction"> - <title>½éÉÜ</title> - <para> - The syntax and semantics of the regular expressions sup- - ported by PCRE are described below. Regular expressions are - also described in the Perl documentation and in a number of - other books, some of which have copious examples. Jeffrey - Friedl's "Mastering Regular Expressions", published by - O'Reilly (ISBN 1-56592-257-3), covers them in great detail. - The description here is intended as reference documentation. - - A regular expression is a pattern that is matched against a - subject string from left to right. Most characters stand for - themselves in a pattern, and match the corresponding charac- - ters in the subject. As a trivial example, the pattern - <literal>The quick brown fox</literal> - matches a portion of a subject string that is identical to - itself. - </para> + <refsect2 id="regexp.introduction"> + <title>½éÉÜ</title> + <para> + ÏÂÃæËµÃ÷ PCRE ËùÖ§³ÖµÄÕýÔò±í´ïʽµÄÓï·¨ºÍÓïÒå¡£Perl + ÎĵµºÍºÜ¶àÆäËüÊéÖÐÒ²½â˵ÁËÕýÔò±í´ïʽ£¬ÓеÄÊéÖÐÓкܶàÀý×Ó¡£Jeffrey + Friedl дµÄ¡°Mastering Regular Expressions¡±£¬ÓÉ O'Reilly + ³ö°æÉç·¢ÐУ¨ISBN 1-56592-257-3£©£¬°üº¬ÁË´óÁ¿Ï¸½Ú¡£ÕâÀïµÄ˵Ã÷Ö»ÊǸö²Î¿¼Îĵµ¡£ + </para> + <para> + ÕýÔò±í´ïʽÊÇ´Ó×óÏòÓÒȥƥÅäÄ¿±ê×Ö·û´®µÄÒ»×éģʽ¡£´ó¶àÊý×Ö·ûÔÚģʽÖбíʾËüÃÇ×ÔÉí²¢Æ¥ÅäÄ¿±êÖÐÏàÓ¦µÄ×Ö·û¡£×÷Ϊһ¸öСÀý×Ó£¬Ä£Ê½ + <literal>The quick brown fox</literal> Æ¥ÅäÁËÄ¿±ê×Ö·û´®ÖÐÓëÆäÍêÈ«ÏàͬµÄÒ»²¿·Ö¡£ + </para> </refsect2> <refsect2 id="regexp.reference.meta"> <title>Ôª×Ö·û</title> <para> - The power of regular expressions comes from the - ability to include alternatives and repetitions in the pat- - tern. These are encoded in the pattern by the use of <emphasis>meta</emphasis>- - <emphasis>characters</emphasis>, which do not stand for themselves but instead - are interpreted in some special way. + ÕýÔò±í´ïʽµÄÍþÁ¦ÔÚÓÚÆäÄܹ»ÔÚģʽÖаüº¬Ñ¡ÔñºÍÑ»·¡£ËüÃÇͨ¹ýʹÓÃ<emphasis>Ôª×Ö·û</emphasis>À´±àÂëÔÚģʽÖУ¬Ôª×Ö·û²»´ú±íÆä×ÔÉí£¬ËüÃÇÓÃÒ»Ð©ÌØÊâµÄ·½Ê½À´½âÎö¡£ </para> <para> - There are two different sets of meta-characters: those that - are recognized anywhere in the pattern except within square - brackets, and those that are recognized in square brackets. - Outside square brackets, the meta-characters are as follows: + ÓÐÁ½×鲻ͬµÄÔª×Ö·û£ºÒ»ÖÖÊÇģʽÖгýÁË·½À¨ºÅÄÚ¶¼Äܱ»Ê¶±ðµÄ£¬»¹ÓÐÒ»ÖÖÊÇÔÚ·½À¨ºÅÄÚ±»Ê¶±ðµÄ¡£·½À¨ºÅÖ®ÍâµÄÔª×Ö·ûÓÐÕâЩ£º <variablelist> <varlistentry> <term><emphasis>\</emphasis></term> @@ -183,7 +169,7 @@ <term><emphasis>^</emphasis></term> <listitem> <simpara> - Æ¥ÅäÄ¿±êµÄ¿ªÍ·£¨»òÔÚ¶àÐÐģʽÏÂÐеĿªÍ·£¬¼´½ôËæÒ»»»ÐзûÖ®ºó£© + ¶ÏÑÔÄ¿±êµÄ¿ªÍ·£¨»òÔÚ¶àÐÐģʽÏÂÐеĿªÍ·£¬¼´½ôËæÒ»»»ÐзûÖ®ºó£© </simpara> </listitem> </varlistentry> @@ -191,7 +177,7 @@ <term><emphasis>$</emphasis></term> <listitem> <simpara> - Æ¥ÅäÄ¿±êµÄ½á⣨»òÔÚ¶àÐÐģʽÏÂÐеĽá⣬¼´½ôËæÒ»»»Ðзû֮ǰ£© + ¶ÏÑÔÄ¿±êµÄ½á⣨»òÔÚ¶àÐÐģʽÏÂÐеĽá⣬¼´½ôËæÒ»»»Ðзû֮ǰ£© </simpara> </listitem> </varlistentry> @@ -319,7 +305,7 @@ </listitem> </varlistentry> </variablelist> - ÏÂÃæËµÃ÷ÁËÿһ¸öÔª×Ö·ûµÄÓ÷¨¡£ + ÒÔÏÂ˵Ã÷ÁËÿһ¸öÔª×Ö·ûµÄÓ÷¨¡£ </para> </refsect2> <refsect2 id="regexp.reference.backslash"> @@ -336,14 +322,7 @@ Ñ¡ÏģʽÖеĿհ××Ö·û£¨×Ö·ûÀàÖÐÒÔÍâµÄ£©ÒÔ¼°×Ö·ûÀàÖ®ÍâµÄ¡°#¡±µ½»»ÐзûÖ®¼äµÄ×Ö·û¶¼±»ºöÂÔ¡£¿ÉÒÔÓÃתÒåµÄ·´Ð±Ïß½«¿Õ°××Ö·û»òÕß¡°#¡±×Ö·û°üÀ¨µ½Ä£Ê½ÖÐÈ¥¡£ </para> <para> - ·´Ð±ÏߵĵڶþÖÖÓÃ;ÌṩÁËÒ»ÖÖÔÚģʽÖÐÒԿɼû·½Ê½È¥±àÂë²»¿É´òÓ¡×Ö·ûµÄ·½·¨¡£ - A second use of backslash provides a way of encoding non- - printing characters in patterns in a visible manner. There - is no restriction on the appearance of non-printing characters, - apart from the binary zero that terminates a pattern, - but when a pattern is being prepared by text editing, it is - usually easier to use one of the following escape sequences - than the binary character it represents: + ·´Ð±ÏߵĵڶþÖÖÓÃ;ÌṩÁËÒ»ÖÖÔÚģʽÖÐÒԿɼû·½Ê½È¥±àÂë²»¿É´òÓ¡×Ö·ûµÄ·½·¨¡£²¢Ã»Óв»¿É´òÓ¡×Ö·û³öÏÖµÄÏÞÖÆ£¬³ýÁË´ú±íģʽ½áÊøµÄ¶þ½øÖÆÁãÒÔÍâ¡£µ«ÓÃÎı¾±à¼Æ÷À´×¼±¸Ä£Ê½µÄʱºò£¬Í¨³£ÓÃÒÔϵÄתÒåÐòÁÐÀ´±íʾÄÇЩ¶þ½øÖÆ×Ö·û¸üÈÝÒ×һЩ£º </para> <para> <variablelist> @@ -359,7 +338,7 @@ <term><emphasis>\cx</emphasis></term> <listitem> <simpara> - "control-x"£¬ÆäÖÐ x ÊÇÈÎÒâ×Ö·û + "control-x"£¬ÆäÖÐ x ÊÇÈÎÒâ×Ö·û </simpara> </listitem> </varlistentry> @@ -536,7 +515,7 @@ <term><emphasis>\d</emphasis></term> <listitem> <simpara> - ÈκÎÊ®½øÖÆÊý + ÈÎһʮ½øÖÆÊý×Ö </simpara> </listitem> </varlistentry> @@ -544,7 +523,7 @@ <term><emphasis>\D</emphasis></term> <listitem> <simpara> - ÈκηÇÊ®½øÖÆÊýµÄ×Ö·û + ÈÎÒ»·ÇÊ®½øÖÆÊýµÄ×Ö·û </simpara> </listitem> </varlistentry> @@ -552,7 +531,7 @@ <term><emphasis>\s</emphasis></term> <listitem> <simpara> - Èκοհ××Ö·û + ÈÎÒ»¿Õ°××Ö·û </simpara> </listitem> </varlistentry> @@ -560,7 +539,7 @@ <term><emphasis>\S</emphasis></term> <listitem> <simpara> - Èκηǿհ××Ö·û + ÈÎÒ»·Ç¿Õ°××Ö·û </simpara> </listitem> </varlistentry> @@ -568,7 +547,7 @@ <term><emphasis>\w</emphasis></term> <listitem> <simpara> - ÈκΡ°×Ö¡±µÄ×Ö·û + ÈÎÒ»¡°×Ö¡±µÄ×Ö·û </simpara> </listitem> </varlistentry> @@ -576,41 +555,27 @@ <term><emphasis>\W</emphasis></term> <listitem> <simpara> - ÈκΡ°·Ç×Ö¡±µÄ×Ö·û + ÈÎÒ»¡°·Ç×Ö¡±µÄ×Ö·û </simpara> </listitem> </varlistentry> </variablelist> </para> <para> - Each pair of escape sequences partitions the complete set of - characters into two disjoint sets. Any given character - matches one, and only one, of each pair. - </para> - <para> - A "word" character is any letter or digit or the underscore - character, that is, any character which can be part of a - Perl "<literal>word</literal>". The definition of letters and digits is - controlled by PCRE's character tables, and may vary if locale-specific - matching is taking place (see "Locale support" - above). For example, in the "fr" (French) locale, some char- - acter codes greater than 128 are used for accented letters, - and these are matched by <literal>\w</literal>. - </para> - <para> - These character type sequences can appear both inside and - outside character classes. They each match one character of - the appropriate type. If the current matching point is at - the end of the subject string, all of them fail, since there - is no character to match. - </para> - <para> - The fourth use of backslash is for certain simple asser- - tions. An assertion specifies a condition that has to be met - at a particular point in a match, without consuming any - characters from the subject string. The use of subpatterns - for more complicated assertions is described below. The - backslashed assertions are + ÈκÎÒ»¸öתÒåÐòÁн«ÍêÕûµÄ×Ö·û×éºÏ·Ö¸î³ÉÁ½¸ö·ÖÀëµÄ²¿·Ö¡£ÈÎÒ»¸ø¶¨µÄ×Ö·ûÆ¥ÅäÒ»¸öÇÒ½öÒ»¸öתÒåÐòÁС£ + </para> + <para> + ¡°×Ö¡±µÄ×Ö·ûÊÇÖ¸ÈκÎÒ»¸ö×Öĸ»òÊý×Ö»òÏ»®Ïߣ¬Ò²¾ÍÊÇ˵£¬ÈκοÉÒÔÊÇ + Perl "<literal>word</literal>" µÄ×Ö·û¡£×ÖĸºÍÊý×ֵ͍ÒåÓÉ + PCRE ×Ö·û±í¿ØÖÆ£¬¿ÉÄÜ»á¸ù¾ÝÖ¸¶¨ÇøÓòµÄÆ¥Åä¶ø¸Ä±ä£¨¼ûÉÏÃæµÄ¡°ÇøÓòÖ§³Ö¡±£©¡£¾ÙÀý˵£¬ÔÚ + "fr" (French) ÇøÓò£¬Ä³Ð©±àÂë´óÓÚ 128 µÄ×Ö·ûÓÃÀ´±íÊ¾ÖØÒô×Öĸ£¬ÕâЩ×Ö·ûÄܹ»±» + <literal>\w</literal> ËùÆ¥Åä¡£ + </para> + <para> + ÕâЩ×Ö·ûÀàÐÍÐòÁпÉÒÔ³öÏÖÔÚ×Ö·ûÀàÖ®ÖкÍÖ®Í⡣ÿһ¸öÆ¥ÅäÏàÓ¦ÀàÐÍÖеÄÒ»¸ö×Ö·û¡£Èç¹ûµ±Ç°Æ¥ÅäµãÔÚÄ¿±ê×Ö·û´®µÄ½á⣬ÒÔÉÏËùÓÐÆ¥Å䶼ʧ°Ü£¬ÒòΪûÓÐ×Ö·û¿É¹©Æ¥Åä¡£ + </para> + <para> + ·´Ð±ÏߵĵÚËĸöÓ÷¨ÊÇijЩ¼òµ¥µÄ¶ÏÑÔ¡£¶ÏÑÔÊÇÖ¸ÔÚÒ»¸öÆ¥ÅäÖеÄÌØ¶¨Î»ÖñØÐë´ïµ½µÄÌõ¼þ£¬²¢²»»áÏûºÄÄ¿±ê×Ö·û´®ÖеÄÈκÎ×Ö·û¡£×ÓģʽÖиü¸´ÔӵĶÏÑÔµÄÓ÷¨ÔÚÏÂÃæÃèÊö¡£·´Ð±ÏߵĶÏÑÔÓУº </para> <para> <variablelist> @@ -642,7 +607,7 @@ <term><emphasis>\Z</emphasis></term> <listitem> <simpara> - Ä¿±êµÄ½áβ»ò½áβµÄ»»Ðзû£¨Óë¶àÐÐģʽÎ޹أ© + Ä¿±êµÄ½áβ»òλÓÚ½áβµÄ»»Ðзûǰ£¨Óë¶àÐÐģʽÎ޹أ© </simpara> </listitem> </varlistentry> @@ -657,31 +622,25 @@ </variablelist> </para> <para> - These assertions may not appear in character classes (but - note that "<literal>\b</literal>" has a different meaning, namely the backspace - character, inside a character class). - </para> - <para> - A word boundary is a position in the subject string where - the current character and the previous character do not both - match <literal>\w</literal> or <literal>\W</literal> (i.e. one matches - <literal>\w</literal> and the other matches - <literal>\W</literal>), or the start or end of the string if the first - or last character matches \w, respectively. - </para> - <para> - The <literal>\A</literal>, <literal>\Z</literal>, and - <literal>\z</literal> assertions differ from the traditional - circumflex and dollar (described below) in that they only - ever match at the very start and end of the subject string, - whatever options are set. They are not affected by the - <link linkend="pcre.pattern.modifiers">PCRE_NOTBOL</link> or - <link linkend="pcre.pattern.modifiers">PCRE_NOTEOL</link> options. - The difference between <literal>\Z</literal> and - <literal>\z</literal> is that <literal>\Z</literal> - matches before a newline that is the - last character of the string as well as at the end of the - string, whereas <literal>\z</literal> matches only at the end. + ÕâЩ¶ÏÑÔ¿ÉÄܲ»ÄܳöÏÖÔÚ×Ö·ûÀàÖУ¨µ«ÊÇ×¢Òâ + "<literal>\b</literal>" Óв»Í¬µÄº¬Ò壬ÔÚ×Ö·ûÀàÖ®ÖÐÒ²¾ÍÊÇ·´Ð±Ïß×Ö·û£©¡£ + </para> + <para> + ×ֱ߽çÊÇÄ¿±ê×Ö·û´®ÖеÄÒ»¸öλÖã¬Æäµ±Ç°×Ö·ûºÍǰһ¸ö×Ö·û²»ÄÜͬʱƥÅä + <literal>\w</literal> »òÕß <literal>\W</literal>£¨Ò²¾ÍÊÇÆäÖÐÒ»¸öÆ¥Åä + <literal>\w</literal> ¶øÁíÒ»¸öÆ¥Åä + <literal>\W</literal>£©£¬»òÕßÊÇ×Ö·û´®µÄ¿ªÍ·»ò½á⣬¼ÙÈçµÚÒ»¸ö»ò×îºóÒ»¸ö×Ö·ûÆ¥Åä + \w µÄ»°¡£ + </para> + <para> + <literal>\A</literal>£¬<literal>\Z</literal> ºÍ <literal>\z</literal> + ¶ÏÑÔÓ봫ͳµÄÒôµ÷·ûºÍÃÀÔª·û£¨ÏÂÃæËµÃ÷£©µÄ²»Í¬Ö®´¦ÔÚÓÚËüÃǽöÆ¥ÅäÄ¿±ê×Ö·û´®µÄ¾ø¶Ô¿ªÍ·ºÍ½áβ¶ø²»¹ÜÉ趨ÁËÈκÎÑ¡Ïî¡£ËüÃDz»ÊÜ + <link linkend="pcre.pattern.modifiers">PCRE_NOTBOL</link> »ò + <link linkend="pcre.pattern.modifiers">PCRE_NOTEOL</link> + Ñ¡ÏîµÄÓ°Ïì¡£<literal>\Z</literal> ºÍ + <literal>\z</literal> µÄ²»Í¬Ö®´¦ÔÚÓÚ <literal>\Z</literal> + Æ¥ÅäÁË×÷Ϊ×Ö·û´®×îºóÒ»¸ö×Ö·ûµÄ»»Ðзû֮ǰÒÔ¼°×Ö·û´®µÄ½á⣬¶ø + <literal>\z</literal> ½öÆ¥Åä×Ö·û´®µÄ½áβ¡£ </para> </refsect2>
Index: phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml diff -u phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml:1.2 phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml:1.3 --- phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml:1.2 Fri Sep 5 18:26:05 2003 +++ phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml Tue Sep 9 21:39:55 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.5 Maintainer: dallas Status: partial --> <refentry id="pcre.pattern.syntax"> @@ -34,9 +34,9 @@ </listitem> <listitem> <simpara> - PCRE ²»ÔÊÐíÏòǰƥÅäÖØ¸´µÄÊýÁ¿·û¡£Perl + PCRE ²»ÔÊÐíÔÚÏòǰ¶ÏÑÔÖÐʹÓÃÖØ¸´µÄÊýÁ¿·û¡£Perl ÔÊÐíÕâÑù£¬µ«¿ÉÄܲ»ÊÇÄãÏëÏóÖеĺ¬Òå¡£ÀýÈ磬(?!a){3} - ²¢²»Æ¥ÅäÏÂÃæÈý¸ö²»ÊÇ¡°a¡±µÄ×Ö·û£¬¶øÊÇÆ¥ÅäÏÂÒ»¸ö²»ÊÇ¡°a¡±µÄ×Ö·ûÈý´Î¡£ + ²¢²»ÊǶÏÑÔÏÂÃæÈý¸ö×Ö·û²»ÊÇ¡°a¡±£¬¶øÊǶÏÑÔÏÂÒ»¸ö×Ö·û²»ÊÇ¡°a¡±Èý´Î¡£ </simpara> </listitem> <listitem> @@ -68,7 +68,7 @@ </listitem> <listitem> <simpara> - ²»Ö§³Ö Perl µÄ \G Æ¥Å䣬ÒòΪÕâºÍµ¥¸öµÄģʽƥÅäÎ޹ء£ + ²»Ö§³Ö Perl µÄ \G ¶ÏÑÔ£¬ÒòΪÕâºÍµ¥¸öµÄģʽƥÅäÎ޹ء£ </simpara> </listitem> <listitem> @@ -136,40 +136,26 @@ <refsect1 id="regexp.reference"> <title>ÕýÔò±í´ïʽÏê½â</title> - <refsect2 id="regexp.introduction"> - <title>½éÉÜ</title> - <para> - The syntax and semantics of the regular expressions sup- - ported by PCRE are described below. Regular expressions are - also described in the Perl documentation and in a number of - other books, some of which have copious examples. Jeffrey - Friedl's "Mastering Regular Expressions", published by - O'Reilly (ISBN 1-56592-257-3), covers them in great detail. - The description here is intended as reference documentation. - - A regular expression is a pattern that is matched against a - subject string from left to right. Most characters stand for - themselves in a pattern, and match the corresponding charac- - ters in the subject. As a trivial example, the pattern - <literal>The quick brown fox</literal> - matches a portion of a subject string that is identical to - itself. - </para> + <refsect2 id="regexp.introduction"> + <title>½éÉÜ</title> + <para> + ÏÂÃæËµÃ÷ PCRE ËùÖ§³ÖµÄÕýÔò±í´ïʽµÄÓï·¨ºÍÓïÒå¡£Perl + ÎĵµºÍºÜ¶àÆäËüÊéÖÐÒ²½â˵ÁËÕýÔò±í´ïʽ£¬ÓеÄÊéÖÐÓкܶàÀý×Ó¡£Jeffrey + Friedl дµÄ¡°Mastering Regular Expressions¡±£¬ÓÉ O'Reilly + ³ö°æÉç·¢ÐУ¨ISBN 1-56592-257-3£©£¬°üº¬ÁË´óÁ¿Ï¸½Ú¡£ÕâÀïµÄ˵Ã÷Ö»ÊǸö²Î¿¼Îĵµ¡£ + </para> + <para> + ÕýÔò±í´ïʽÊÇ´Ó×óÏòÓÒȥƥÅäÄ¿±ê×Ö·û´®µÄÒ»×éģʽ¡£´ó¶àÊý×Ö·ûÔÚģʽÖбíʾËüÃÇ×ÔÉí²¢Æ¥ÅäÄ¿±êÖÐÏàÓ¦µÄ×Ö·û¡£×÷Ϊһ¸öСÀý×Ó£¬Ä£Ê½ + <literal>The quick brown fox</literal> Æ¥ÅäÁËÄ¿±ê×Ö·û´®ÖÐÓëÆäÍêÈ«ÏàͬµÄÒ»²¿·Ö¡£ + </para> </refsect2> <refsect2 id="regexp.reference.meta"> <title>Ôª×Ö·û</title> <para> - The power of regular expressions comes from the - ability to include alternatives and repetitions in the pat- - tern. These are encoded in the pattern by the use of <emphasis>meta</emphasis>- - <emphasis>characters</emphasis>, which do not stand for themselves but instead - are interpreted in some special way. + ÕýÔò±í´ïʽµÄÍþÁ¦ÔÚÓÚÆäÄܹ»ÔÚģʽÖаüº¬Ñ¡ÔñºÍÑ»·¡£ËüÃÇͨ¹ýʹÓÃ<emphasis>Ôª×Ö·û</emphasis>À´±àÂëÔÚģʽÖУ¬Ôª×Ö·û²»´ú±íÆä×ÔÉí£¬ËüÃÇÓÃÒ»Ð©ÌØÊâµÄ·½Ê½À´½âÎö¡£ </para> <para> - There are two different sets of meta-characters: those that - are recognized anywhere in the pattern except within square - brackets, and those that are recognized in square brackets. - Outside square brackets, the meta-characters are as follows: + ÓÐÁ½×鲻ͬµÄÔª×Ö·û£ºÒ»ÖÖÊÇģʽÖгýÁË·½À¨ºÅÄÚ¶¼Äܱ»Ê¶±ðµÄ£¬»¹ÓÐÒ»ÖÖÊÇÔÚ·½À¨ºÅÄÚ±»Ê¶±ðµÄ¡£·½À¨ºÅÖ®ÍâµÄÔª×Ö·ûÓÐÕâЩ£º <variablelist> <varlistentry> <term><emphasis>\</emphasis></term> @@ -183,7 +169,7 @@ <term><emphasis>^</emphasis></term> <listitem> <simpara> - Æ¥ÅäÄ¿±êµÄ¿ªÍ·£¨»òÔÚ¶àÐÐģʽÏÂÐеĿªÍ·£¬¼´½ôËæÒ»»»ÐзûÖ®ºó£© + ¶ÏÑÔÄ¿±êµÄ¿ªÍ·£¨»òÔÚ¶àÐÐģʽÏÂÐеĿªÍ·£¬¼´½ôËæÒ»»»ÐзûÖ®ºó£© </simpara> </listitem> </varlistentry> @@ -191,7 +177,7 @@ <term><emphasis>$</emphasis></term> <listitem> <simpara> - Æ¥ÅäÄ¿±êµÄ½á⣨»òÔÚ¶àÐÐģʽÏÂÐеĽá⣬¼´½ôËæÒ»»»Ðзû֮ǰ£© + ¶ÏÑÔÄ¿±êµÄ½á⣨»òÔÚ¶àÐÐģʽÏÂÐеĽá⣬¼´½ôËæÒ»»»Ðзû֮ǰ£© </simpara> </listitem> </varlistentry> @@ -319,7 +305,7 @@ </listitem> </varlistentry> </variablelist> - ÏÂÃæËµÃ÷ÁËÿһ¸öÔª×Ö·ûµÄÓ÷¨¡£ + ÒÔÏÂ˵Ã÷ÁËÿһ¸öÔª×Ö·ûµÄÓ÷¨¡£ </para> </refsect2> <refsect2 id="regexp.reference.backslash"> @@ -336,14 +322,7 @@ Ñ¡ÏģʽÖеĿհ××Ö·û£¨×Ö·ûÀàÖÐÒÔÍâµÄ£©ÒÔ¼°×Ö·ûÀàÖ®ÍâµÄ¡°#¡±µ½»»ÐзûÖ®¼äµÄ×Ö·û¶¼±»ºöÂÔ¡£¿ÉÒÔÓÃתÒåµÄ·´Ð±Ïß½«¿Õ°××Ö·û»òÕß¡°#¡±×Ö·û°üÀ¨µ½Ä£Ê½ÖÐÈ¥¡£ </para> <para> - ·´Ð±ÏߵĵڶþÖÖÓÃ;ÌṩÁËÒ»ÖÖÔÚģʽÖÐÒԿɼû·½Ê½È¥±àÂë²»¿É´òÓ¡×Ö·ûµÄ·½·¨¡£ - A second use of backslash provides a way of encoding non- - printing characters in patterns in a visible manner. There - is no restriction on the appearance of non-printing characters, - apart from the binary zero that terminates a pattern, - but when a pattern is being prepared by text editing, it is - usually easier to use one of the following escape sequences - than the binary character it represents: + ·´Ð±ÏߵĵڶþÖÖÓÃ;ÌṩÁËÒ»ÖÖÔÚģʽÖÐÒԿɼû·½Ê½È¥±àÂë²»¿É´òÓ¡×Ö·ûµÄ·½·¨¡£²¢Ã»Óв»¿É´òÓ¡×Ö·û³öÏÖµÄÏÞÖÆ£¬³ýÁË´ú±íģʽ½áÊøµÄ¶þ½øÖÆÁãÒÔÍâ¡£µ«ÓÃÎı¾±à¼Æ÷À´×¼±¸Ä£Ê½µÄʱºò£¬Í¨³£ÓÃÒÔϵÄתÒåÐòÁÐÀ´±íʾÄÇЩ¶þ½øÖÆ×Ö·û¸üÈÝÒ×һЩ£º </para> <para> <variablelist> @@ -359,7 +338,7 @@ <term><emphasis>\cx</emphasis></term> <listitem> <simpara> - "control-x"£¬ÆäÖÐ x ÊÇÈÎÒâ×Ö·û + "control-x"£¬ÆäÖÐ x ÊÇÈÎÒâ×Ö·û </simpara> </listitem> </varlistentry> @@ -536,7 +515,7 @@ <term><emphasis>\d</emphasis></term> <listitem> <simpara> - ÈκÎÊ®½øÖÆÊý + ÈÎһʮ½øÖÆÊý×Ö </simpara> </listitem> </varlistentry> @@ -544,7 +523,7 @@ <term><emphasis>\D</emphasis></term> <listitem> <simpara> - ÈκηÇÊ®½øÖÆÊýµÄ×Ö·û + ÈÎÒ»·ÇÊ®½øÖÆÊýµÄ×Ö·û </simpara> </listitem> </varlistentry> @@ -552,7 +531,7 @@ <term><emphasis>\s</emphasis></term> <listitem> <simpara> - Èκοհ××Ö·û + ÈÎÒ»¿Õ°××Ö·û </simpara> </listitem> </varlistentry> @@ -560,7 +539,7 @@ <term><emphasis>\S</emphasis></term> <listitem> <simpara> - Èκηǿհ××Ö·û + ÈÎÒ»·Ç¿Õ°××Ö·û </simpara> </listitem> </varlistentry> @@ -568,7 +547,7 @@ <term><emphasis>\w</emphasis></term> <listitem> <simpara> - ÈκΡ°×Ö¡±µÄ×Ö·û + ÈÎÒ»¡°×Ö¡±µÄ×Ö·û </simpara> </listitem> </varlistentry> @@ -576,41 +555,27 @@ <term><emphasis>\W</emphasis></term> <listitem> <simpara> - ÈκΡ°·Ç×Ö¡±µÄ×Ö·û + ÈÎÒ»¡°·Ç×Ö¡±µÄ×Ö·û </simpara> </listitem> </varlistentry> </variablelist> </para> <para> - Each pair of escape sequences partitions the complete set of - characters into two disjoint sets. Any given character - matches one, and only one, of each pair. - </para> - <para> - A "word" character is any letter or digit or the underscore - character, that is, any character which can be part of a - Perl "<literal>word</literal>". The definition of letters and digits is - controlled by PCRE's character tables, and may vary if locale-specific - matching is taking place (see "Locale support" - above). For example, in the "fr" (French) locale, some char- - acter codes greater than 128 are used for accented letters, - and these are matched by <literal>\w</literal>. - </para> - <para> - These character type sequences can appear both inside and - outside character classes. They each match one character of - the appropriate type. If the current matching point is at - the end of the subject string, all of them fail, since there - is no character to match. - </para> - <para> - The fourth use of backslash is for certain simple asser- - tions. An assertion specifies a condition that has to be met - at a particular point in a match, without consuming any - characters from the subject string. The use of subpatterns - for more complicated assertions is described below. The - backslashed assertions are + ÈκÎÒ»¸öתÒåÐòÁн«ÍêÕûµÄ×Ö·û×éºÏ·Ö¸î³ÉÁ½¸ö·ÖÀëµÄ²¿·Ö¡£ÈÎÒ»¸ø¶¨µÄ×Ö·ûÆ¥ÅäÒ»¸öÇÒ½öÒ»¸öתÒåÐòÁС£ + </para> + <para> + ¡°×Ö¡±µÄ×Ö·ûÊÇÖ¸ÈκÎÒ»¸ö×Öĸ»òÊý×Ö»òÏ»®Ïߣ¬Ò²¾ÍÊÇ˵£¬ÈκοÉÒÔÊÇ + Perl "<literal>word</literal>" µÄ×Ö·û¡£×ÖĸºÍÊý×ֵ͍ÒåÓÉ + PCRE ×Ö·û±í¿ØÖÆ£¬¿ÉÄÜ»á¸ù¾ÝÖ¸¶¨ÇøÓòµÄÆ¥Åä¶ø¸Ä±ä£¨¼ûÉÏÃæµÄ¡°ÇøÓòÖ§³Ö¡±£©¡£¾ÙÀý˵£¬ÔÚ + "fr" (French) ÇøÓò£¬Ä³Ð©±àÂë´óÓÚ 128 µÄ×Ö·ûÓÃÀ´±íÊ¾ÖØÒô×Öĸ£¬ÕâЩ×Ö·ûÄܹ»±» + <literal>\w</literal> ËùÆ¥Åä¡£ + </para> + <para> + ÕâЩ×Ö·ûÀàÐÍÐòÁпÉÒÔ³öÏÖÔÚ×Ö·ûÀàÖ®ÖкÍÖ®Í⡣ÿһ¸öÆ¥ÅäÏàÓ¦ÀàÐÍÖеÄÒ»¸ö×Ö·û¡£Èç¹ûµ±Ç°Æ¥ÅäµãÔÚÄ¿±ê×Ö·û´®µÄ½á⣬ÒÔÉÏËùÓÐÆ¥Å䶼ʧ°Ü£¬ÒòΪûÓÐ×Ö·û¿É¹©Æ¥Åä¡£ + </para> + <para> + ·´Ð±ÏߵĵÚËĸöÓ÷¨ÊÇijЩ¼òµ¥µÄ¶ÏÑÔ¡£¶ÏÑÔÊÇÖ¸ÔÚÒ»¸öÆ¥ÅäÖеÄÌØ¶¨Î»ÖñØÐë´ïµ½µÄÌõ¼þ£¬²¢²»»áÏûºÄÄ¿±ê×Ö·û´®ÖеÄÈκÎ×Ö·û¡£×ÓģʽÖиü¸´ÔӵĶÏÑÔµÄÓ÷¨ÔÚÏÂÃæÃèÊö¡£·´Ð±ÏߵĶÏÑÔÓУº </para> <para> <variablelist> @@ -642,7 +607,7 @@ <term><emphasis>\Z</emphasis></term> <listitem> <simpara> - Ä¿±êµÄ½áβ»ò½áβµÄ»»Ðзû£¨Óë¶àÐÐģʽÎ޹أ© + Ä¿±êµÄ½áβ»òλÓÚ½áβµÄ»»Ðзûǰ£¨Óë¶àÐÐģʽÎ޹أ© </simpara> </listitem> </varlistentry> @@ -657,31 +622,25 @@ </variablelist> </para> <para> - These assertions may not appear in character classes (but - note that "<literal>\b</literal>" has a different meaning, namely the backspace - character, inside a character class). - </para> - <para> - A word boundary is a position in the subject string where - the current character and the previous character do not both - match <literal>\w</literal> or <literal>\W</literal> (i.e. one matches - <literal>\w</literal> and the other matches - <literal>\W</literal>), or the start or end of the string if the first - or last character matches \w, respectively. - </para> - <para> - The <literal>\A</literal>, <literal>\Z</literal>, and - <literal>\z</literal> assertions differ from the traditional - circumflex and dollar (described below) in that they only - ever match at the very start and end of the subject string, - whatever options are set. They are not affected by the - <link linkend="pcre.pattern.modifiers">PCRE_NOTBOL</link> or - <link linkend="pcre.pattern.modifiers">PCRE_NOTEOL</link> options. - The difference between <literal>\Z</literal> and - <literal>\z</literal> is that <literal>\Z</literal> - matches before a newline that is the - last character of the string as well as at the end of the - string, whereas <literal>\z</literal> matches only at the end. + ÕâЩ¶ÏÑÔ¿ÉÄܲ»ÄܳöÏÖÔÚ×Ö·ûÀàÖУ¨µ«ÊÇ×¢Òâ + "<literal>\b</literal>" Óв»Í¬µÄº¬Ò壬ÔÚ×Ö·ûÀàÖ®ÖÐÒ²¾ÍÊÇ·´Ð±Ïß×Ö·û£©¡£ + </para> + <para> + ×ֱ߽çÊÇÄ¿±ê×Ö·û´®ÖеÄÒ»¸öλÖã¬Æäµ±Ç°×Ö·ûºÍǰһ¸ö×Ö·û²»ÄÜͬʱƥÅä + <literal>\w</literal> »òÕß <literal>\W</literal>£¨Ò²¾ÍÊÇÆäÖÐÒ»¸öÆ¥Åä + <literal>\w</literal> ¶øÁíÒ»¸öÆ¥Åä + <literal>\W</literal>£©£¬»òÕßÊÇ×Ö·û´®µÄ¿ªÍ·»ò½á⣬¼ÙÈçµÚÒ»¸ö»ò×îºóÒ»¸ö×Ö·ûÆ¥Åä + \w µÄ»°¡£ + </para> + <para> + <literal>\A</literal>£¬<literal>\Z</literal> ºÍ <literal>\z</literal> + ¶ÏÑÔÓ봫ͳµÄÒôµ÷·ûºÍÃÀÔª·û£¨ÏÂÃæËµÃ÷£©µÄ²»Í¬Ö®´¦ÔÚÓÚËüÃǽöÆ¥ÅäÄ¿±ê×Ö·û´®µÄ¾ø¶Ô¿ªÍ·ºÍ½áβ¶ø²»¹ÜÉ趨ÁËÈκÎÑ¡Ïî¡£ËüÃDz»ÊÜ + <link linkend="pcre.pattern.modifiers">PCRE_NOTBOL</link> »ò + <link linkend="pcre.pattern.modifiers">PCRE_NOTEOL</link> + Ñ¡ÏîµÄÓ°Ïì¡£<literal>\Z</literal> ºÍ + <literal>\z</literal> µÄ²»Í¬Ö®´¦ÔÚÓÚ <literal>\Z</literal> + Æ¥ÅäÁË×÷Ϊ×Ö·û´®×îºóÒ»¸ö×Ö·ûµÄ»»Ðзû֮ǰÒÔ¼°×Ö·û´®µÄ½á⣬¶ø + <literal>\z</literal> ½öÆ¥Åä×Ö·û´®µÄ½áβ¡£ </para> </refsect2>