Doc #78168 [Ver->Csd]: Reference Format is \n instead of \\n
| From: | cmb@php.net | Date: | Tue, 10 Mar 2020 09:11:40 +0000 |
| Subject: | Doc #78168 [Ver->Csd]: Reference Format is \n instead of \\n | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-17388@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78168&edit=1
ID: 78168
Updated by: cmb@php.net
Reported by: michael dot nique at gmx dot de
Summary: Reference Format is \n instead of \\n
-Status: Verified
+Status: Closed
Type: Documentation Problem
Package: PCRE related
Operating System: Linux
PHP Version: Irrelevant
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2020-03-10 09:11:09] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=349366
Log: Fix #78168: Reference Format is \n instead of \\n
------------------------------------------------------------------------
[2019-06-15 02:17:45] requinix@php.net
\\n is because people are liable to use double-quoted strings so the backslash would have to be
escaped. Doubled backslashes will work for both types of strings without needing a second thought.
But IMO the section there is a bit overzealous on the "you need doubled backslashes" when
the truth is that PCRE only wants one, so maybe it could be adjusted a bit.
------------------------------------------------------------------------
[2019-06-14 20:44:36] michael dot nique at gmx dot de
Description:
------------
---
From manual page: https://php.net/function.preg-replace
---
The documentation states: "replacement may contain references of the form \\n or $n"
I think it should be "\n" instead of "\\n", see test-script
Test script:
---------------
echo(preg_replace('/#.*#/', 'A\0B', '#test#'));
Expected result:
----------------
A\0B
Actual result:
--------------
A#test#B
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78168&edit=1