js正则密码验证密码至少包含大写字母,小写字母,数字,且不少于8位

来源:互联网 发布:上海linux运维培训 编辑:程序博客网 时间:2024/05/17 20:34

1.js密码设置验证的正则

<html><head>    <meta charset="utf-8">    <title>密码验证</title></head><body></br><input type="text" id="test1"><input type="button" id="te" onclick="test()"><script>    function test(){        var text= document.getElementById("test1").value;        var   re =/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[^]{8,16}$/;        var result=  re.test(text);        if(result)        {            alert("输入正确");        }else        {            alert("密码至少包含大写字母,小写字母,数字,且不少于8");        }    }</script></body></html>


2.java后台服务端密码设置验证的正则方式:


阅读全文
0 0