|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28138 Error in Backslashing
Submitted: 2004-04-24 22:18 UTC Modified: 2004-04-24 22:29 UTC
From: info at giggygsk dot de Assigned:
Status: Not a bug Package: *Regular Expressions
PHP Version: 4.3.4 OS: Win32
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: info at giggygsk dot de
New email:
PHP Version: OS:


 [2004-04-24 22:18 UTC] info at giggygsk dot de
If you build a Regular Ex. like this: /([^\\]\|\*\|)/ there will be come an error, because 'PHP' think I mean with [^\\] I want backslashing the ']' so it will be do a error, because he want an ']' because it backslashed ']'. But I want the char '\', because thats a Specialchar ;-). 

Reproduce code:

// Result in Perl : Test1 - Test2\|*|Test3
$string = "Test1|*|Test2\|*|Test3";

$split = preg_split("/([^\\]\|\*\|)/", $string);


Expected result:
Warning: Compilation failed: missing terminating ] for character class at offset 17 in D:\Apache2\htdocs\GG_Shoutbox\msg.class.php on line 17


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-24 22:29 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

You need to double escape it, or use single quotes.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Feb 27 23:01:27 2024 UTC