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