|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2019-08-16 09:51 UTC] noskov dot vlad at gmail dot com
Description: ------------ When running preg_match with Unicode character scripts in regular expression it always return 0. https://3v4l.org/sil9c Test script: --------------- var_dump(preg_match('~[\pL\p{Cyrillic}]~u', 'test')); Expected result: ---------------- int(1) Actual result: -------------- int(0) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 09 04:00:01 2025 UTC |
The problem is more subtle than this, as the following all work: var_dump(preg_match('~[\pL\p{Cyrillic}]~u', 'testЛ')); var_dump(preg_match('~[\pL]~u', 'testЛ')); var_dump(preg_match('~[\p{Cyrillic}]~u', 'testЛ')); var_dump(preg_match('~[\pL]~u', 'test')); var_dump(preg_match('~[\p{Cyrillic}]~u', 'Л')); var_dump(preg_match('~\pL~u', 'Л')); var_dump(preg_match('~\p{Cyrillic}~u', 'testЛ')); var_dump(preg_match('~\pL\p{Cyrillic}~u', 'testЛ'));