ID: 46184
Updated by: [EMAIL PROTECTED]
Reported By: vasilkov80 at mail dot ru
-Status: Open
+Status: Bogus
Bug Type: PCRE related
Operating System: linux mandriva 2007
PHP Version: 5.2.6
New Comment:
your regex is wrong.
quote from the PCRE manual:
"Outside a character class, a backslash followed by a digit greater
than 0 (and possibly further digits) is a back reference to a capturing
sub-pattern earlier (that is, to its left) in the pattern, provided
there have been that many previous capturing left parentheses."
Previous Comments:
------------------------------------------------------------------------
[2008-09-26 15:44:59] vasilkov80 at mail dot ru
sorry, expected result:
Array
(
[0] => "image.jpg"
[1] => "
[2] => image.jpg
)
------------------------------------------------------------------------
[2008-09-26 15:38:24] vasilkov80 at mail dot ru
Description:
------------
a problem with internal vars?
/\"([^\"]+\.jpg)\"/ - the pattern works fine...
/([\"\'])([^\\1]+\.jpg)\\1/ - a bit more complex pattern doesn't work
as expected!
Reproduce code:
---------------
if( preg_match("%([\"\']{1})([^\\1]+\.jpg)\\1%", '.. "bla bla
"image.jpg" .. " bla bla', $matches) )
print_r($matches);
Expected result:
----------------
Array
(
[0] => "image.jpg"
[1] => image.jpg
)
Actual result:
--------------
Array
(
[0] => "bla bla "image.jpg"
[1] => "
[2] => bla bla "image.jpg
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=46184&edit=1