How to find Hebrew?

i "m tries to trick if a line begins (first letter), width of RTL language / Hebrew.

any ideas?

+15
javascript regex right-to-left hebrew
source share
5 answers

Hebrew letters encoded in Hebrew will be found here. Unicode Code Range: [\u0590-\u05FF]

+21
source share

JavaScript does not support regular expression scripts such as \p{InHebrew} (or something similar). However, it supports Unicode escapes, so you can use regular expressions like:

 /[\u0590-\u05FF]/ 

which will correspond to one character in Hebrew.

See: http://unicode.org/charts/PDF/U0590.pdf and: http://www.regular-expressions.info/unicode.html

+17
source share
 // First choose the required validation HebrewChars = new RegExp("^[\u0590-\u05FF]+$"); AlphaNumericChars = new RegExp("^[a-zA-Z0-9\-]+$"); EnglishChars = new RegExp("^[a-zA-Z\-]+$"); LegalChars = new RegExp("^[a-zA-Z\-\u0590-\u05FF ]+$"); //Note that this one allows space // Then use it if (!LegalChars.test(Field)) { return false; } 
+7
source share

if (str.charCodeAt(0) >= 0x590) && (str.charCodeAt(0) <= 0x5FF) then is considered a gay symbol

+3
source share

Especially for Hebrew, the question already answers - regarding all ranges:

Specially for JS, I would recommend a tool for creating your regular expression - see Unicode range RegExp generator (Composes character ranges suitable for use in JavaScript)

[just select the Hebrew or scripts or ranges that you want)

0
source share

All Articles