C#:
Regex rx = new Regex("^[\u4E00-\u9FA5]+$");
if(rx.IsMatch(textbox1.text)){
是汉字
}else{
不是汉字
}
js:
function checkname(name){
var strExp=new RegExp(/^[\u4E00-\u9FA5]+$/);
if(strExp.test(name)){
return true;
}else{
return false;
}
}
转载于:https://www.cnblogs.com/Yellowshorts/archive/2013/01/28/2879667.html