您的位置:首页 > 其它

特殊符号正则表达式

2014-12-22 14:54 246 查看
var txt=new RegExp("[ ,\\`,\\~,\\!,\\@,\#,\\$,\\%,\\^,\\+,\\*,\\&,\\\\,\\/,\\?,\\|,\\:,\\.,\\<,\\>,\\{,\\},\\(,\\),\\',\\;,\\=,\"]");

//特殊字符正则表达式

if (txt.test(character))

{

alert("User Name can not contain SPACES or any of these special characters:\n , ` ~ ! @ # $ % ^ + & * \\ / ? | : . < > {} () [] \" ");

if (document.all)

{

window.event.returnValue = false;

}

else

{

arguments.callee.caller.arguments[0].preventDefault();

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: