JS 判断是否包含特殊字符
1个回答
展开全部
02020202 来个终极判断特殊字符的武器:
02020202 判断字符中是否包含有特殊字符: function containSpecial( s ) { var containSpecial = RegExp(/[(\ )(\~)(\!)(\@)(\#) (\$)(\%)(\^)(\&)(\*)(\()(\))(\-)(\_)(\+)(\=) (\[)(\])(\{)(\})(\|)(\\)(\;)(\:)(\')(\")(\,)(\.)(\/) (\<)(\>)(\?)(\)]+/); return ( containSpecial.test(s) ); } 0202020202 返回True就表示包含特殊字符喔~~
02020202 判断字符中是否包含有特殊字符: function containSpecial( s ) { var containSpecial = RegExp(/[(\ )(\~)(\!)(\@)(\#) (\$)(\%)(\^)(\&)(\*)(\()(\))(\-)(\_)(\+)(\=) (\[)(\])(\{)(\})(\|)(\\)(\;)(\:)(\')(\")(\,)(\.)(\/) (\<)(\>)(\?)(\)]+/); return ( containSpecial.test(s) ); } 0202020202 返回True就表示包含特殊字符喔~~
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询