|  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
 [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: Fri Jun 14 18:01:32 2024 UTC