标签:style blog color io ar div cti sp log
//校验特殊字符 function _checkCharacter(string){ var flag = ""; var regLegal = /^[a-zA-Z0-9\.,の:%![]【】~\u4e00-\u9fa5]*$/, //必须包含这些字符 regRepeat = /([\.,の:%![]【】~])\1\1\1/; //相同字符不能连续出现3次以上 if(!regLegal.test(string)){ flag = "输入字符不合法"; } else if(regRepeat.test(string)){ flag = "特殊字符不得连续超过3个"; } else if (string.length > 12){ flag = "输入字符长度超过限制"; } return flag; }
标签:style blog color io ar div cti sp log
原文地址:http://www.cnblogs.com/baoguanxia/p/3962121.html