function checkStr(str) {
let myReg = /[~!@#$%^&*()+=|{}':;',\[\]\\/\|<>?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]/;
if (myReg.test(str)) {
return true;
}
return false;
}
该博客介绍了JavaScript中用于检查字符串是否包含特殊字符的函数`checkStr`,使用正则表达式`/[~!@#$%^&*()+=|{}
function checkStr(str) {
let myReg = /[~!@#$%^&*()+=|{}':;',\[\]\\/\|<>?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]/;
if (myReg.test(str)) {
return true;
}
return false;
}

被折叠的 条评论
为什么被折叠?