首页 > 代码库 > 特殊符号验证规则

特殊符号验证规则

判断字符中是否包含有特殊字符: 

function containSpecial( s ) {

  var containSpecial = RegExp(/[(\ )(\~)(\!)(\@)(\#)(\$)(\%)(\^)(\&)(\*)(\()(\))(\-)(\_)(\+)(\=)(\[)(\])(\{)(\})(\|)(\\)(\;)(\:)(\‘)(\")(\,)(\.)(\/)(\<)(\>)(\?)(\)]+/);

  return ( containSpecial.test(s) );

}    

特殊符号验证规则