JS 判断是否包含特殊字符

判断字符中是否包含有特殊字符:  
  
function containSpecial( s )      
{      
    var containSpecial = RegExp(/[(\ )(\~)(\!)(\@)(\#)  
(\$)(\%)(\^)(\&)(\*)(\()(\))(\-)(\_)(\+)(\=)  
(\[)(\])(\{)(\})(\|)(\\)(\;)(\:)(\')(\")(\,)(\.)(\/)  
(\<)(\>)(\?)(\)]+/);      
    return ( containSpecial.test(s) );      
}     

猜你喜欢

转载自blog.csdn.net/qq_37383968/article/details/89428354