js中用正则表达式 过滤特殊字符 校验所有输入域是否含有特殊符号
1个回答
展开全部
function containSpecial( s )
{
var containSpecial = RegExp(/[(\ )(\~)(\!)(\@)(\#)
(\$)(\%)(\^)(\&)(\*)(\()(\))(\-)(\_)(\+)(\=)
(\[)(\])(\{)(\})(\|)(\\)(\;)(\:)(\')(\")(\,)(\.)(\/)
(\<)(\>)(\?)(\)]+/);
return ( containSpecial.test(s) );
}
{
var containSpecial = RegExp(/[(\ )(\~)(\!)(\@)(\#)
(\$)(\%)(\^)(\&)(\*)(\()(\))(\-)(\_)(\+)(\=)
(\[)(\])(\{)(\})(\|)(\\)(\;)(\:)(\')(\")(\,)(\.)(\/)
(\<)(\>)(\?)(\)]+/);
return ( containSpecial.test(s) );
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询