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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
36 - 11 = ?
Subscribe to this entry?

 
 [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: Sat Apr 20 02:01:29 2024 UTC