views:

181

answers:

3

hi,

i"m trying to fint if a string starts(first letter) width an RTL language/ hebrew.

any ideas?

+2  A: 

This will find hebrew letters encoded in the Hebrew Unicode code point range: [\u0590-\u05FF]

Oded
thanks! works perfectly
+1  A: 

if (str.charCodeAt(0) > 0x590) && (str.charCodeAt(0) < 0x5FF) then it is most probably a hebrew character

alemjerus
"most probably"? I'd say "definitely" :)
Joey
+2  A: 

JavaScript does not support regex scripts like \p{InHebrew} (or something similar). However, it does support Unicode escapes, so you could use a regex like:

/[\u0590–\u05FF]/

which will match a single Hebrew character.

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

Bart Kiers