php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #70981 preg back-reference page needs $n form
Submitted: 2015-11-26 23:44 UTC Modified: 2015-11-27 18:46 UTC
From: dave at dbarc dot net Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2015-11-26 23:44 UTC] 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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-11-27 00:23 UTC] salathe@php.net
-Status: Open +Status: Not a bug
 [2015-11-27 00:23 UTC] 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-27 18:46 UTC] dave at dbarc dot net
Thanks. And thanks for being polite.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 02:01:29 2024 UTC