|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-12-05 15:51 UTC] sdamir at gmail dot com
[2006-12-05 16:09 UTC] tony2001@php.net
[2006-12-05 17:32 UTC] sdamir at gmail dot com
[2006-12-05 17:33 UTC] sdamir at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 04:00:02 2025 UTC |
Description: ------------ I am trying to match all alphabetic utf8 characters. I know (tested) that in perl if $string is utf8 encoded and if i use regex like =~ /\w/ it will match all alphabetic utf8 characters, (cirilic alphabet, chinese, english etc.). However this is not the case for php. I read i need to use special patterns like \pL , well this doesn't work for me either, it matches some characters but cirilic letters aren't matched. I don't know if this is a bug or i am doing something wrong but i really searched the hell out of everything, visited tons of irc support channels no one has an answer to this. Reproduce code: --------------- <?php // setlocale(LC_ALL, 'en_US.utf8'); // if i set locale to en_US, it matches some characters like ??? but not rilic, en_US.utf8 wont match anything. $str=" Срећа "; utf8_encode($str); var_dump($str); preg_match("/[\w\pL]/u",$str, $r); var_dump($r); ?> Expected result: ---------------- string(3) " s " array(1) { [0]=> string(1) "С" } Actual result: -------------- string(12) " Срећа " array(0) { }