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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
41 - 34 = ?
Subscribe to this entry?

 
 [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 27 13:01:31 2024 UTC