Edit report at http://bugs.php.net/bug.php?id=53951&edit=1

 ID:                 53951
 Updated by:         ahar...@php.net
 Reported by:        dtremblay dot fafard at gmail dot com
 Summary:            Preg_match_all question/does not return ALL values
-Status:             Open
+Status:             Bogus
 Type:               Feature/Change Request
 Package:            *General Issues
 Operating System:   Linux
 PHP Version:        5.3.5
 Block user comment: N
 Private report:     N

 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.




Previous Comments:
------------------------------------------------------------------------
[2011-02-07 19:38:26] dtremblay dot fafard at gmail dot com

Description:
------------
---

>From manual page:
http://www.php.net/function.preg-match-all#Description

---



Preg_match_all does not get ALL results.

Test script:
---------------
preg_match_all("/abba/", "abbabba", $resultats);



foreach($resultats[0] as $resultat){

        echo $resultat;

}



Expected result:
----------------
I expect to get 2x abba found instead of 1.  I see 1x abba found.  It is
specifically said that it will be 1 because it start the second search
after the end of the last result found.  Why do it this way?  It is not
that hard to start after the first character of the string found.  So 
There must be some kind of performance reason, which I would like to
understand.





This comes from the fact that I want to get ALL words in a sentence. 
But all words are surrounded by white spaces.  So I have to put the
white spaces in my regex. But because of that I HAVE to double the white
spaces to get ALL words.  Which is something I would like to avoid for
performance.



Please if you have time, send me an email to explain me why is it done
that way.



Thank you in advance.

Actual result:
--------------
I see 1x abba found.




------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53951&edit=1

Reply via email to