AS3.0 正则表达式判断中文

匹配中文字符的正则表达式: [\u4e00-\u9fa5]
匹配双字节字符(包括汉字在内):[^\x00-\xff]

[code]

function isChinese(temp)
{
var re = /[^\u4e00-\u9fa5]/;
if(re.test(temp)) return false;
return true;
}
trace(isChinese(“中文”));
[/code]

发表评论?

0 条评论。

发表评论


注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>