日期:2014-05-16  浏览次数:20402 次

JS 判断是否包含特殊字符

???? 来个终极判断特殊字符的武器:

?

???

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

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

?

???? 返回True就表示包含特殊字符喔~~