1、去除首尾空白
String.prototype.trim= function ()
{
return this .replace(/(^/s*)|(/s*$)/g, "" );
}
2、邮箱格式验证
function isEmail(str){ var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((/.[a-zA-Z0-9_-]{2,3}){1,2})$/; return reg.test(str); }
待续中……
1、去除首尾空白
String.prototype.trim= function ()
{
return this .replace(/(^/s*)|(/s*$)/g, "" );
}
2、邮箱格式验证
function isEmail(str){ var reg = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((/.[a-zA-Z0-9_-]{2,3}){1,2})$/; return reg.test(str); }
待续中……