how can i detect hebrew characters both iso8859-8 and utf8 in a string using php

hebrew, php, regex

Solution

Here's map of the iso8859-8 character set. The range E0 - FA appears to be reserved for Hebrew. You could check for those characters in a character class:

[\xE0-\xFA]

For UTF-8, the range reserved for Hebrew appears to be 0591 to 05F4. So you could detect that with:

[\u0591-\u05F4]

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

echo preg_match("/[\u0591-\u05F4]/", $string);

Problem

I want to be able to detect (using regular expressions) if a string contains hebrew characters both utf8 and iso8859-8 in the php programming language. thanks!

Original source