cvs: phpdoc-zh /reference/pcre/functions pcre.pattern.syntax.xml
| From: | Dallas Thunder | Date: | Sun, 21 Sep 2003 20:28:54 +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-1754@lists.php.net to get a copy of this message | ||
dallas Sun Sep 21 16:28:54 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.4
phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml:1.5
--- phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml:1.4 Mon Sep 15 14:47:32 2003
+++ phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml Sun Sep 21 16:28:54 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="gb2312"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
<!-- $Author: dallas $ -->
<!-- EN-Revision: 1.5 Maintainer: dallas Status: partial -->
<refentry id="pcre.pattern.syntax">
@@ -757,75 +757,68 @@
</refsect2>
<refsect2 id="regexp.reference.internal-options">
- <title>Internal option setting</title>
- <literallayout>
- The settings of <link
linkend="pcre.pattern.modifiers">PCRE_CASELESS</link> ,
- <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link> ,
- <link linkend="pcre.pattern.modifiers">PCRE_DOTALL</link> ,
- and <link linkend="pcre.pattern.modifiers">PCRE_EXTENDED</link> can be
changed from within the pattern by
- a sequence of Perl option letters enclosed between "(?" and
- ")". The option letters are
-
- i for <link linkend="pcre.pattern.modifiers">PCRE_CASELESS</link>
- m for <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link>
- s for <link linkend="pcre.pattern.modifiers">PCRE_DOTALL</link>
- x for <link linkend="pcre.pattern.modifiers">PCRE_EXTENDED</link>
-
- For example, (?im) sets caseless, multiline matching. It is
- also possible to unset these options by preceding the letter
- with a hyphen, and a combined setting and unsetting such as
- (?im-sx), which sets <link
linkend="pcre.pattern.modifiers">PCRE_CASELESS</link> and <link
linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link> while
- unsetting <link linkend="pcre.pattern.modifiers">PCRE_DOTALL</link> and
<link linkend="pcre.pattern.modifiers">PCRE_EXTENDED</link> , is also
permitted.
- If a letter appears both before and after the hyphen, the
- option is unset.
-
- The scope of these option changes depends on where in the
- pattern the setting occurs. For settings that are outside
- any subpattern (defined below), the effect is the same as if
- the options were set or unset at the start of matching. The
- following patterns all behave in exactly the same way:
-
+ <title>ÄÚ²¿Ñ¡ÏîÉ趨</title>
+ <para>
+ <link
+ linkend="pcre.pattern.modifiers">PCRE_CASELESS</link>£¬<link
+ linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link>£¬<link
+ linkend="pcre.pattern.modifiers">PCRE_DOTALL</link> ºÍ
+ <link linkend="pcre.pattern.modifiers">PCRE_EXTENDED</link>
+ µÄÉ趨¿ÉÒÔÔÚģʽÄÚ²¿Í¨¹ý°üº¬ÔÚ
+ "(?" ºÍ ")" Ö®¼äµÄ Perl
Ñ¡Ïî×ÖĸÐòÁÐÀ´¸Ä±ä¡£Ñ¡Ïî×ÖĸΪ£º
+ <screen>
+<![CDATA[
+ i ±íʾ <link linkend="pcre.pattern.modifiers">PCRE_CASELESS</link>
+ m ±íʾ <link
linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link>
+ s ±íʾ <link linkend="pcre.pattern.modifiers">PCRE_DOTALL</link>
+ x ±íʾ <link linkend="pcre.pattern.modifiers">PCRE_EXTENDED</link>
+]]>
+ </screen>
+ ÀýÈ磬(?im)
É趨Á˲»Çø·Ö´óСд£¬¶àÐÐÆ¥Åä¡£Ò²¿ÉÒÔͨ¹ýÔÚ×Öĸǰ¼ÓÉϼõºÅÀ´È¡ÏûÕâЩѡÏî¡£ÀýÈç×éºÏµÄÑ¡Ïî
+ (?im-sx)£¬É趨ÁË
+ <link linkend="pcre.pattern.modifiers">PCRE_CASELESS</link> ºÍ
+ <link
linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link>£¬²¢È¡ÏûÁË
+ <link linkend="pcre.pattern.modifiers">PCRE_DOTALL</link> ºÍ
+ <link
linkend="pcre.pattern.modifiers">PCRE_EXTENDED</link>¡£Èç¹ûÒ»¸ö×ÖĸÔÚ¼õºÅ֮ǰÓëÖ®ºó¶¼³öÏÖÁË£¬Ôò¸ÃÑ¡ÏȡÏûÉ趨¡£
+ </para>
+ <para>
+
ÕâЩѡÏî¸Ä±äµÄ·¶Î§ÒÀÀµÓÚÉ趨ÔÚģʽ³öÏÖµÄλÖá£×Óģʽ£¨ÔÚºóÃæ¶¨Ò壩֮ÍâµÄÉ趨£¬ÆäЧ¹ûµÈͬÓÚÑ¡ÏîÔÚ¿ªÊ¼Æ¥ÅäʱÉ趨»òÕßÈ¡ÏûÉ趨¡£ÏÂÃæµÄģʽÐÐΪÍêÈ«Ïàͬ£º
+ <screen>
+<![CDATA[
(?i)abc
a(?i)bc
ab(?i)c
abc(?i)
-
- which in turn is the same as compiling the pattern abc with
- <link linkend="pcre.pattern.modifiers">PCRE_CASELESS</link> set.
- In other words, such "top level" settings apply to the whole
- pattern (unless there are other changes inside subpatterns).
- If there is more than one setting of the same option at top level,
- the rightmost setting is used.
-
- If an option change occurs inside a subpattern, the effect
- is different. This is a change of behaviour in Perl 5.005.
- An option change inside a subpattern affects only that part
- of the subpattern that follows it, so
-
+]]>
+ </screen>
+ ËüÃǵÈͬÓÚ½«Ä£Ê½ "abc" ¼ÓÉÏÑ¡Ïî
+ <link
linkend="pcre.pattern.modifiers">PCRE_CASELESS</link>¡£»»¾ä»°Ëµ£¬ÕâÖÖ¡°¶¥²ã¡±É趨ÊÊÓÃÓÚÕû¸öģʽ£¨³ý·ÇÔÚ×ÓģʽÖÐÓÖÓÐÆäËüÐ޸ģ©¡£Èç¹û¶Ôij¸öÑ¡ÏîÓг¬¹ýÒ»¸öµÄ¶¥²ãÉ趨£¬ÔòʹÓÃ×îÓұߵÄÒ»¸ö¡£
+ </para>
+ <para>
+ Èç¹ûÑ¡Ïî¸Ä±ä³öÏÖÓÚ×ÓģʽÖУ¬ÔòЧ¹û²»Í¬¡£ÕâÊÇ
+ Perl 5.005
µÄÐÐΪµÄÒ»¸ö±ä»¯¡£×ÓģʽÖеÄÑ¡Ïî¸Ä±äÖ»Ó°Ïìµ½×ÓģʽÄÚ²¿ÆäºóµÄ²¿·Ö£¬Òò´Ë
+ <screen>
+<![CDATA[
(a(?i)b)c
-
- matches abc and aBc and no other strings (assuming
- <link linkend="pcre.pattern.modifiers">PCRE_CASELESS</link> is not
used). By this means, options can be
- made to have different settings in different parts of the
- pattern. Any changes made in one alternative do carry on
- into subsequent branches within the same subpattern. For
- example,
-
+]]>
+ </screen>
+ ½«Ö»Æ¥Åä "abc" ºÍ "aBc"£¨¼Ù¶¨Ã»ÓÐʹÓÃ
+ <link
linkend="pcre.pattern.modifiers">PCRE_CASELESS</link>£©¡£ÕâÒâζ×ÅÑ¡ÏîÔÚģʽµÄ²»Í¬²¿Î»¿ÉÒÔÔì³É²»Í¬µÄÉ趨¡£ÔÚÒ»¸ö·ÖÖ§Öеĸıä¿ÉÒÔ´«µÝµ½Í¬Ò»¸ö×ÓģʽÖкóÃæµÄ·ÖÖ§ÖУ¬ÀýÈ磺
+ <screen>
+<![CDATA[
(a(?i)b|c)
-
- matches "ab", "aB", "c", and "C", even though when
matching
- "C" the first branch is abandoned before the option setting.
- This is because the effects of option settings happen at
- compile time. There would be some very weird behaviour otherwise.
-
- The PCRE-specific options <link
linkend="pcre.pattern.modifiers">PCRE_UNGREEDY</link> and
- <link linkend="pcre.pattern.modifiers">PCRE_EXTRA</link> can
- be changed in the same way as the Perl-compatible options by
- using the characters U and X respectively. The (?X) flag
- setting is special in that it must always occur earlier in
- the pattern than any of the additional features it turns on,
- even when it is at top level. It is best put at the start.
- </literallayout>
+]]>
+ </screen>
+ ½«Æ¥Åä "ab"£¬"aB"£¬"c" ºÍ
"C"£¬¾¡¹ÜÔÚÆ¥Åä "C"
+
µÄʱºòµÚÒ»¸ö·ÖÖ§»áÔÚÑ¡ÏîÉ趨֮ǰ¾Í±»¶ªÆú¡£ÕâÊÇÒòΪѡÏîÉ趨µÄЧ¹ûÊÇÔÚ±àÒëʱȷ¶¨µÄ£¬·ñÔò»áÔì³É·Ç³£¹ÖÒìµÄÐÐΪ¡£
+ <para>
+ </para>
+ PCRE רÓÃÑ¡Ïî
+ <link linkend="pcre.pattern.modifiers">PCRE_UNGREEDY</link> ºÍ
+ <link linkend="pcre.pattern.modifiers">PCRE_EXTRA</link>
+ ¿ÉÒÔºÍ Perl
¼æÈÝÑ¡ÏîÒÔͬÑùµÄ·½Ê½À´¸Ä±ä£¬·Ö±ðʹÓÃ×Öĸ
+ U ºÍ X¡£(?X)
±ê¼ÇÉ趨ÓÐÐ©ÌØÊ⣬Ëü±ØÐë³öÏÖÓÚÈÎºÎÆäËüÌØÐÔ֮ǰ¡£×îºÃ·ÅÔÚ×ͷµÄλÖá£
+ </para>
</refsect2>
<refsect2 id="regexp.reference.subpatterns">