php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #13547 String position of preg_match_all
Submitted: 2001-10-04 15:41 UTC Modified: 2003-08-17 16:40 UTC
From: ejbe99 at hotmail dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.6 OS: Windows
Private report: No CVE-ID: None
 [2001-10-04 15:41 UTC] ejbe99 at hotmail dot com
Hello.
I am not sure if a lot of other people would want this, but a humungous amount of programmers I know need this.
There should be a feature in php, a function like
preg_mall_strpos or another parameter in preg_match_all.
What it should do is in each set of matches in preg_match_all, it should also give the string position
of the match. This means $matches would look like this:
Array(0=>Array(0=>Array(0=> blah 1=> nother blah) 
1=>Array(0=> 30 1=>52)));
The reason we wouldn't just use preg_replace,
is because a lot of us need to replace a mass
amount of matches according to the previous or future match. Without this you would need a very complicated function --- Well not too complicated, but if it is a
common problem you should make the parameter.
Thanks in advance!
EJ 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-17 16:40 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 03:01:29 2024 UTC