#28138 [Opn->Bgs]: Error in Backslashing
| From: | derick@php.net | Date: | Sat, 24 Apr 2004 20:29:28 +0000 |
| Subject: | #28138 [Opn->Bgs]: Error in Backslashing | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-58697@lists.php.net to get a copy of this message | ||
ID: 28138
Updated by: derick@php.net
Reported By: info at giggygsk dot de
-Status: Open
+Status: Bogus
Bug Type: *Regular Expressions
Operating System: Win32
PHP Version: 4.3.4
New Comment:
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 http://www.php.net/support.php 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.
Previous Comments:
------------------------------------------------------------------------
[2004-04-24 22:18:58] info at giggygsk dot de
Description:
------------
Hi.
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:
---------------
<?php
// 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28138&edit=1