php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2623 Escaping a backslash doesn't seem to work in preg_replace
Submitted: 1999-10-27 13:02 UTC Modified: 1999-10-28 12:42 UTC
From: rob dot duarte at fmr dot com Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0.12 OS: Solaris 2.5.1
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: rob dot duarte at fmr dot com
New email:
PHP Version: OS:

 

 [1999-10-27 13:02 UTC] rob dot duarte at fmr dot com
$url = preg_replace( "/\\/", "/", $var);

This returns...

Warning: No ending delimiter found in /usr/local/apache/htdocs/projects/documentation.php3 on line 18


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-10-27 13:10 UTC] rob dot duarte at fmr dot com
Workaround:

$url = preg_replace( "/\\134/", "/", $var);


 [1999-10-28 12:42 UTC] andrei at cvs dot php dot net
This has been fixed in CVS.
Note:
Since PHP does its own backslashing in strings, in order for your
pattern to work properly it would need to look like:
"/\\\\/"

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 09:01:26 2025 UTC