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

时间:2020-04-07 21:29:15   收藏:0   阅读:78

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);

 

原文:https://www.cnblogs.com/newmiracle/p/12656031.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!