php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19853 preg_split, PREG_SPLIT_DELIM_CAPTURE does not capture the delimiter
Submitted: 2002-10-10 13:24 UTC Modified: 2002-10-10 13:32 UTC
From: lange at haas-media dot de Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 4.2.2 OS: Redhat Linux 7.2
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: lange at haas-media dot de
New email:
PHP Version: OS:

 

 [2002-10-10 13:24 UTC] lange at haas-media dot de
$test = 'This is a text with an $id inside';

$matches = preg_split('#(\$[a-z]*)#', $test,
PREG_SPLIT_DELIM_CAPTURE);

echo '<pre>';
print_r($matches);
echo '</pre>';

expected output:
Array
(
    [0] => "This is a text with an "
    [1] => $id
    [2] => " inside"
)

output produced in the real world:
Array
(
    [0] => "This is a text with an "
    [1] => " inside"
)

maybe this will help to hunt the bug down.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-10 13:32 UTC] lange at haas-media dot de
$test = 'This is a text with an $id inside';

$matches = preg_split('#(\$[a-z]*)#', $test,
PREG_SPLIT_DELIM_CAPTURE);

echo '<pre>';
print_r($matches);
echo '</pre>';

expected output:
Array
(
    [0] => "This is a text with an "
    [1] => $id
    [2] => " inside"
)

output produced in the real world:
Array
(
    [0] => "This is a text with an "
    [1] => " inside"
)

maybe this will help to hunt the bug down.
-- edit
important note: actually no bug at all, missed the limit param.
---
a wise man said: do not report a bug after a hard 10 hour work day.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Dec 06 02:03:34 2021 UTC