php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44543 preg_split: patterns with assertions
Submitted: 2008-03-26 22:33 UTC Modified: 2008-03-26 22:44 UTC
From: unkind at regex dot su Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.2.5 OS: Windows XP
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: unkind at regex dot su
New email:
PHP Version: OS:

 

 [2008-03-26 22:33 UTC] unkind at regex dot su
Description:
------------
I want to split string like this: "cell:cell:cell with '\:':cell" by pattern "/(?!\\):/"

Reproduce code:
---------------
<?php
$s = "cell:cell:cell with '\\:':cell";
$s = preg_split('/(?!\\\\):/', $s);

print_r( $s );
?>

Expected result:
----------------
Array
(
    [0] => cell
    [1] => cell
    [2] => cell with ':'
    [3] => cell
)

Actual result:
--------------
Array
(
    [0] => cell
    [1] => cell
    [2] => cell with '\
    [3] => '
    [4] => cell
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-26 22:44 UTC] felipe@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The your regexp no make senses, and a regexp doesn't will remove the escape on matching.

http://www.pcre.org/man.txt
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 14:01:33 2024 UTC