From f08d4fefdb693448369fd2a08a2f5caaccb2b827 Mon Sep 17 00:00:00 2001 From: Andrei Zmievski Date: Wed, 15 Nov 2000 15:01:03 +0000 Subject: [PATCH] Explain $n backreferences. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@35813 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/pcre.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/functions/pcre.xml b/functions/pcre.xml index 6cd2fc909b..c25ae91463 100644 --- a/functions/pcre.xml +++ b/functions/pcre.xml @@ -315,15 +315,15 @@ part 3: </a> matches are replaced. - Replacement may contain references of the - form \\n. Every - such reference will be replaced by the text captured by the - n'th parenthesized pattern. + Replacement may contain references of the form + \\n or (since PHP 4.0.4) + $n, with the latter form + being the preferred one. Every such reference will be replaced by the text + captured by the n'th parenthesized pattern. n can be from 0 to 99, and - \\0 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. + \\0 or $0 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. If no matches are found in subject, then @@ -692,7 +692,7 @@ $fl_array = preg_grep ("/^(\d+)?\.\d+$/", $array); If this modifier is set, preg_replace - 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.