How to tell if a string contains characters in Hebrew using PHP?

前端 未结 3 985
我在风中等你
我在风中等你 2020-12-18 03:53

Trying to figure out how to tell whether a string contains any characters in Hebrew with no luck.

How can this be done?

3条回答
  •  感动是毒
    2020-12-18 04:50

    map of the iso8859-8 character set. The range E0 - FA appears to be reserved for Hebrew.

    [\xE0-\xFA]
    

    For UTF-8, the range reserved for Hebrew appears to be 0590 to 05FF.

    [\u0590-\u05FF]
    

    Here's an example of a regex match in PHP:

    echo preg_match("/[\u0590-\u05FF]/", $string);
    

提交回复
热议问题