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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dave at dbarc dot net
New email:
PHP Version: OS:

 

 [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-2020 The PHP Group
All rights reserved.
Last updated: Wed Dec 02 01:01:24 2020 UTC