cho*_*wey 2 javascript regex internationalization
我试图使用正则表达式检测希伯来字符.根据我的阅读,这是Unicode范围内的任何字符0x0590-0x05ff.
但是,以下不起作用:
// Character code \u05e6
var c = String.fromCharCode(parseInt('05e6', 16));
/[\u0590–\u05ff]/.test(c); // false
Run Code Online (Sandbox Code Playgroud)
但是以下的DOES有效:
// Character code \u05e6
var c = String.fromCharCode(parseInt('05e6', 16));
/[\u0590–\u05e8\u05e9-\u05ff]/.test(c); // true
Run Code Online (Sandbox Code Playgroud)
为什么?为什么我必须将范围拆分为0x0590-0x05e8加号0x05e9-0x05ff?
我在Chrome和Firefox中使用JavaScript测试过它们,它们都具有相同的行为.