|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #32458 preg_split return only offsets
Submitted: 2005-03-25 21:38 UTC Modified: 2019-03-18 16:17 UTC
Avg. Score:2.5 ± 1.7
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: pornel at despammed dot com Assigned:
Status: Open Package: PCRE related
PHP Version: Irrelevant OS: all
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-03-25 21:38 UTC] pornel at despammed dot com
PREG_SPLIT_OFFSET_CAPTURE is useful for creation of custom parsers - allows to find positions of matching strings.
If offset is known - returned string is not needed, as it might be accessed in various other ways.

I suggest adding flag PREG_SPLIT_OFFSETS_ONLY (or PREG_SPLIT_NO_CAPTURE) that would (hopefully) boost performance when preg_split is used to tokenize long strings.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-25 21:45 UTC] pornel at despammed dot com
New parameter, "start at", that causes command to ignore number of initial chars, would nicely complement this feature.
 [2016-08-07 18:09 UTC]
-Package: Feature/Change Request +Package: PCRE related
 [2019-03-18 16:17 UTC]
Related to bug #77744. I don't understand why one would want to have this behavior on preg_split() though, rather than preg_match()/preg_match_all().
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 17 16:01:28 2024 UTC