Doc #70981 [Nab]: preg back-reference page needs $n form

From: Date: Fri, 27 Nov 2015 18:46:38 +0000
Subject: Doc #70981 [Nab]: preg back-reference page needs $n form
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-12886@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70981&edit=1 ID: 70981 User updated by: dave at dbarc dot net Reported by: dave at dbarc dot net Summary: preg back-reference page needs $n form Status: Not a bug Type: Documentation Problem Package: Documentation problem PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Thanks. And thanks for being polite. Previous Comments: ------------------------------------------------------------------------ [2015-11-27 00:23:44] salathe@php.net This is not a bug. It seems you are confusing back references within a pattern, with references in a replacement string. Numeric back references are used within a regex pattern to match what has been matched by an earlier (more left) subpattern. These use the backslash-number syntax only. Replacement strings can use the backslash-number syntax, or the alternative and preferred dollar-number syntax, to refer to subpatterns from the match, to insert into the replacement. ------------------------------------------------------------------------ [2015-11-26 23:44:27] dave at dbarc dot net Description: ------------ --- From manual page: http://www.php.net/regexp.reference.back-references --- (If I'm off-base here, just ignore me) This page should have the "$n" form of the backreference. "being the preferred one". See http://php.net/manual/en/function.preg-replace.php ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70981&edit=1

« previous php.doc.bugs (#12886) next »