preg_match and Hebrew?

preg_match and Hebrew?

Justin thelonecabbage at gmail.com
Mon Sep 7 10:17:49 IDT 2009


Zend operates out of some pretty swank offices in Ramat Gan. So I doubt the
PHP core team would be able to get very far without keeping some kind of
Hebrew support.

2009/8/4 Yuval Hager <yuval at avramzon.net>

> Let's try some regex matching in PHP.
> ,----
> | php > echo preg_match('/\w/', 'a');
> | 1
> `----
>
> ok, so the basic stuff works in English. Let's go on.
>
> ,----
> | php > echo preg_match("/\w/", 'א');
> | 0
> | php > echo preg_match('/\w/u', 'א');
> | 0
> `----
>
> Oops.. maybe some kind of encoding issue? My whole system is UTF8, so this
> should not be a problem I guess..
> ,----
> | php > var_dump('א');
> | string(2) "א"
> `----
>
> So I revert to the soon-to-be-deprecated mb_ereg:
>
> ,----
> | php > mb_regex_encoding('UTF-8');
> | php > echo mb_ereg('\w', 'א');
> | 1
> `----
>
> and now it works..
>
> maybe I was wrong expecting preg_match would know hebrew alphanumeric
> characters in the first place? I understand it will for PHP6, but until
> then, beware of sophisticated Hebrew string parsing.
>
> --yuval
>
> _______________________________________________
> Linux-il mailing list
> Linux-il at cs.huji.ac.il
> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>
>


-- 
There must be a beginning of any great matter, but the continuing unto the
end until it be thoroughly finished yields the true glory. -- Sir Francis
Drake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20090907/2c033dba/attachment.html>


More information about the Linux-il mailing list