[PHP-DOC] cvs: phpdoc /en/functions pcre.xml From: Andrei Zmievski (andrei <email protected>)
Date: 11/15/00

andrei Wed Nov 15 07:01:03 2000 EDT

  Modified files:
    /phpdoc/en/functions pcre.xml
  Log:
  Explain $n backreferences.
  
  
Index: phpdoc/en/functions/pcre.xml
diff -u phpdoc/en/functions/pcre.xml:1.33 phpdoc/en/functions/pcre.xml:1.34
--- phpdoc/en/functions/pcre.xml:1.33 Thu Oct 5 09:40:11 2000
+++ phpdoc/en/functions/pcre.xml Wed Nov 15 07:01:03 2000
@@ -315,15 +315,15 @@
      matches are replaced.
     </para>
     <para>
- <parameter>Replacement</parameter> may contain references of the
- form <literal>\\<replaceable>n</replaceable></literal>. Every
- such reference will be replaced by the text captured by the
- <replaceable>n</replaceable>'th parenthesized pattern.
+ <parameter>Replacement</parameter> may contain references of the form
+ <literal>\\<replaceable>n</replaceable></literal> or (since PHP 4.0.4)
+ <literal><replaceable>$n</replaceable></literal>, with the latter form
+ being the preferred one. Every such reference will be replaced by the text
+ captured by the <replaceable>n</replaceable>'th parenthesized pattern.
      <replaceable>n </replaceable>can be from 0 to 99, and
- <literal>\\0</literal> refers to the text matched by the whole
- pattern. Opening parentheses are counted from left to right
- (starting from 1) to obtain the number of the capturing
- subpattern.
+ <literal>\\0</literal> or <literal>$0</literal> refers to the text matched
+ by the whole pattern. Opening parentheses are counted from left to right
+ (starting from 1) to obtain the number of the capturing subpattern.
     </para>
     <para>
      If no matches are found in <parameter>subject</parameter>, then
@@ -692,7 +692,7 @@
         <listitem>
          <simpara>
           If this modifier is set, <function>preg_replace</function>
- does normal substitution of \\ references in the
+ does normal substitution of backreferences in the
           replacement string, evaluates it as PHP code, and uses the
           result for replacing the search string.
          </simpara>