密码规则校验
1.必须包含数字、下划线、字母,而且可以指定密码长度范围
checkout.pwdCheck = function( str,minLen,maxLen ){ var i,str = str + '',minLen = minLen || 0,len = str.length,maxLen = maxLen || len + 1,// 防止 maxLen 不传报错 pwdReg = [ /\d+?/g,/\w+?/g,/\_+?/g ]; if( minLen > len && maxLen < len || /\s+?/g.test( str ) ) return false; for( i = 0; i < pwdReg.length; i++ ){ if ( !pwdReg[i].test( str ) ) return false; } return true; };原文链接:https://www.f2er.com/regex/358193.html