cvs: phpdoc-zh /reference/pcre/functions pcre.pattern.syntax.xml
| From: | Dallas Thunder | Date: | Fri, 05 Sep 2003 22:26:05 +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-1723@lists.php.net to get a copy of this message | ||
dallas Fri Sep 5 18:26:05 2003 EDT
Modified files:
/phpdoc-zh/reference/pcre/functions pcre.pattern.syntax.xml
Log:
Really hard job, keep going.
Index: phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml
diff -u phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml:1.1
phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml:1.2
--- phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml:1.1 Thu Sep 4 17:24:02 2003
+++ phpdoc-zh/reference/pcre/functions/pcre.pattern.syntax.xml Fri Sep 5 18:26:05 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="gb2312"?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
<!-- $Author: dallas $ -->
<!-- EN-Revision: 1.5 Maintainer: dallas Status: partial -->
<refentry id="pcre.pattern.syntax">
@@ -41,13 +41,17 @@
</listitem>
<listitem>
<simpara>
+
²¶»ñ³öÏÖÔÚÅųýģʽ¶ÏÑÔÖеÄ×ÓģʽËäÈ»±»¼ÆÊý£¬µ«²¢Î´ÔÚÆ«ÒÆÏòÁ¿ÖÐÉ趨ÆäÌõÄ¿¡£Perl
+
ÔÚÆ¥Åäʧ°Üǰ´Ó´ËÖÖģʽÖÐÉ趨ÆäÊý×Ö±äÁ¿£¬µ«Ö»ÔÚÅÅ´¥Ãþʽ¶ÏÑÔÖ»°üº¬Ò»¸ö·Ö֧ʱ¡£
+ <!-- ·Ñ½â£¡
Capturing subpatterns that occur inside negative looka-
head assertions are counted, but their entries in the
- offsets vector are never set. Perl sets its numerical vari-
- ables from any such patterns that are matched before the
+ offsets vector are never set. Perl sets its numerical variables
+ from any such patterns that are matched before the
assertion fails to match something (thereby succeeding), but
- only if the negative lookahead assertion contains just one
+ only if the negative look ahead assertion contains just one
branch.
+ -->
</simpara>
</listitem>
<listitem>
@@ -74,24 +78,21 @@
</listitem>
<listitem>
<simpara>
- There are at the time of writing some oddities in Perl
- 5.005_02 concerned with the settings of captured strings
- when part of a pattern is repeated. For example, matching
- "aba" against the pattern /^(a(b)?)+$/ sets $2 to the value
- "b", but matching "aabbaa" against /^(aa(bb)?)+$/ leaves $2
- unset. However, if the pattern is changed to
- /^(aa(b(b))?)+$/ then $2 (and $3) get set.
- In Perl 5.004 $2 is set in both cases, and that is also &true;
- of PCRE. If in the future Perl changes to a consistent state
- that is different, PCRE may change to follow.
+ µ±²¿·ÖÄ£Ê½ÖØ¸´µÄʱºò£¬ÓÐ¹Ø Perl 5.005_02
+
²¶»ñ×Ö·û´®µÄÉ趨ÓÐЩ¹Å¹ÖµÄµØ·½¡£¾ÙÀý˵£¬ÓÃģʽ
+ /^(a(b)?)+$/ ȥƥÅä "aba" »á½« $2 ÉèΪ
"b"£¬µ«ÊÇÓÃģʽ
+ /^(aa(bb)?)+$/ ȥƥÅä "aabbaa" »áʹ $2
ÎÞÖµ¡£È»¶ø£¬Èç¹û°Ñģʽ¸Ä³É
+ /^(aa(b(b))?)+$/£¬Ôò $2£¨ºÍ $3£©¾ÍÓÐÖµÁË¡£ÔÚ
+ Perl 5.004 ÖÐÒÔÉÏÁ½ÖÖÇé¿öÏ $2 ¶¼»á±»¸³Öµ£¬ÔÚ PCRE
ÖÐÒ²ÊÇ
+ &true;¡£Èç¹ûÒÔºó Perl ¸ÄÁË£¬PCRE ¿ÉÄÜÒ²»á¸úןġ£
</simpara>
</listitem>
<listitem>
<simpara>
- Another as yet unresolved discrepancy is that in Perl
- 5.005_02 the pattern /^(a)?(?(1)a|b)+$/ matches the string
- "a", whereas in PCRE it does not. However, in both Perl and
- PCRE /^(a)?a/ matched against "a" leaves $1 unset.
+ ÁíÒ»¸öδ½â¾öµÄì¶ÜÊÇ Perl 5.005_02 ÖÐģʽ
+ /^(a)?(?(1)a|b)+$/ ÄÜÆ¥ÅäÉÏ×Ö·û´® "a"£¬µ«ÊÇ PCRE
+ ²»»á¡£È»¶ø£¬ÔÚ Perl ºÍ PCRE ÖÐÓà /^(a)?a/
+ ȥƥÅä "a" »áʹ $1 ûÓÐÖµ¡£
</simpara>
</listitem>
<listitem>
@@ -100,31 +101,30 @@
<orderedlist>
<listitem>
<simpara>
- Although lookbehind assertions must match fixed length
- strings, each alternative branch of a lookbehind assertion
- can match a different length of string. Perl 5.005 requires
- them all to have the same length.
+
¾¡¹ÜÏòºó¶ÏÑÔ±ØÐëÆ¥Åä¹Ì¶¨³¤¶È×Ö·û´®£¬µ«Ã¿¸öÏòºó¶ÏÑԵķÖÖ§¿ÉÒÔÆ¥Å䲻ͬ³¤¶ÈµÄ×Ö·û´®¡£Perl
+ 5.005 ÒªÇóËùÓзÖÖ§µÄ³¤¶ÈÏàͬ¡£
</simpara>
</listitem>
<listitem>
<simpara>
- If <link linkend="pcre.pattern.modifiers">PCRE_DOLLAR_ENDONLY</link> is
set and
- <link linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link> is not
- set, the $ meta- character matches only at the very end of
- the string.
+ Èç¹ûÉ趨ÁË
+ <link linkend="pcre.pattern.modifiers">PCRE_DOLLAR_ENDONLY</link>
+ ¶øÃ»ÓÐÉ趨
+ <link
linkend="pcre.pattern.modifiers">PCRE_MULTILINE</link>£¬Ôò
+ $ Ôª×Ö·ûֻƥÅä×Ö·û´®µÄ×îĩβ¡£
</simpara>
</listitem>
<listitem>
<simpara>
- If <link linkend="pcre.pattern.modifiers">PCRE_EXTRA</link> is set, a
backslash followed by a letter
- with no special meaning is faulted.
+ Èç¹ûÉ趨ÁË
+ <link
linkend="pcre.pattern.modifiers">PCRE_EXTRA</link>£¬·´Ð±ÏߺóÃæ¸úÒ»¸öûÓÐÌØÊ⺬ÒåµÄ×Öĸ»á³ö´í¡£
</simpara>
</listitem>
<listitem>
<simpara>
- If <link linkend="pcre.pattern.modifiers">PCRE_UNGREEDY</link> is set,
the greediness of the repeti-
- tion quantifiers is inverted, that is, by default they are
- not greedy, but if followed by a question mark they are.
+ Èç¹ûÉ趨ÁË
+ <link
linkend="pcre.pattern.modifiers">PCRE_UNGREEDY</link>£¬ÔòÖØ¸´µÄÊýÁ¿·ûµÄ
+ greed ±»·´×ª£¬¼´£¬Ä¬ÈÏʱ²»ÊÇ
greedy£¬µ«Èç¹ûºóÃæ¸úÉÏÒ»¸öÎʺžͱä³É greedy ÁË¡£
</simpara>
</listitem>
</orderedlist>