|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-05-12 23:58 UTC] felipe@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 06:00:01 2025 UTC |
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