| tom at foreignproperty dot com 2006-06-26, 3:59 am |
| ID: 37913
User updated by: tom at foreignproperty dot com
Reported By: tom at foreignproperty dot com
-Status: Bogus
+Status: Open
Bug Type: Documentation problem
PHP Version: Irrelevant
New Comment:
look at the array keys.
it goes $matches[0], $matches[1], then jumps to $matches[3] and
$matches[4]
Shouldn't part 2 be matches[2], and part 3 be $matches[3]?
Previous Comments:
------------------------------------------------------------------------
[2006-06-26 08:40:08] takagi@php.net
No, that's perfectly correct.
The regx is "/(<([\w]+)[^>]*> )(.*)(<\/\\2> )/".
So,
[1] correspond to (<([\w]+)[^>]*> ),
[2] correspond to ([\w]+),
[3] correspond to (.*), and
[4] correspond to (<\/\\2> ).
------------------------------------------------------------------------
[2006-06-26 08:16:06] tom at foreignproperty dot com
Description:
------------
In the description for preg_match_all, in the 2nd example, Find
matching HTML tags (greedy), the part 2 and part 3 array values are
wrong ($matches[3], $matches[4]).
echo "matched: " . $matches[0][$i] . "\n";
echo "part 1: " . $matches[1][$i] . "\n";[color=darkred]
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37913&edit=1
|