javascript 过滤中文汉字和 过滤中文汉字和符号的方法

javascript 过滤中文汉字和 过滤中文汉字和中文符号的方法

 

过滤中文汉字

 

   
var hebingdatastr="无法为“

var reg = /[\u4e00-\u9fa5]/g; hebingdatastr = hebingdatastr.replace(reg, "");

 

 

过滤汉字和中文符号

 

var hebingdatastr="ef啦啦,。。d28";
var reg = /[^\x00-\xff]/g;
hebingdatastr = hebingdatastr.replace(reg, "");
alert(hebingdatastr);

 

posted @ 2020-04-07 21:14  newmiracle宇宙  阅读(3206)  评论(0编辑  收藏  举报