js正则表达式 字符检测
<html>
<head></head>
<body>
<script>
//拦截特殊字符
function CheckCode(t) {
var Error = "";
//汉子 a-z 0-9 _- "" " ";
var re = /^[\u4e00-\u9fa5a-z0-9-_-\s*]+$/gi;
if (!re.test(t)) {
Error = "名称中含有特殊字符!";
}
return Error;
}
alert(CheckCode("PPPp 名称中-_含有特殊字符3213"));
</script>
</body>
</html> 相关推荐
wangzhaotongalex 2020-10-20
rechanel 2020-11-16
luofuIT成长记录 2020-09-22
taomengxing 2020-09-07
MaggieRose 2020-08-19
jyj00 2020-08-15
MaggieRose 2020-07-04
modaiairen 2020-06-28
ziggurat 2020-06-28
JnX 2020-06-27
jyj00 2020-06-26
山水沐光 2020-06-25
shqhope 2020-06-23
eroshn 2020-06-21
码墨 2020-06-16
wyq 2020-11-11
TLROJE 2020-10-26
风雨断肠人 2020-10-13