Explain $n backreferences.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@35813 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Andrei Zmievski 2000-11-15 15:01:03 +00:00
parent aed7d37ec7
commit f08d4fefdb

View file

@ -315,15 +315,15 @@ part 3: </a>
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 @@ $fl_array = preg_grep ("/^(\d+)?\.\d+$/", $array);
<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>