ID: 48253
Updated by: [email protected]
Reported By: steve42lawson at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: PCRE related
Operating System: Apache/2.0.52 (Red Hat)
PHP Version: 5.2.9
New Comment:
It's expected.
\w = alphanumeric and _
Previous Comments:
------------------------------------------------------------------------
[2009-05-12 23:46:01] steve42lawson at gmail dot com
Description:
------------
In a pattern parsed by preg_match, the 'backslash-w' meta-character
(which is described as matches 'any "word" character') matches digits as
well (i.e. [0-9]). This is true inside and outside of square-brackets.
Reproduce code:
---------------
$subject = "12345";
$result = preg_match('/\w+/i', $subject);
echo "\w result: $result <br />";
$result = preg_match('/[a-z]+/i', $subject);
echo "[a-z] result: $result <br />";
Expected result:
----------------
\w result: 0
[a-z] result: 0
Actual result:
--------------
\w result: 1
[a-z] result: 0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48253&edit=1